comparison Core/PalanthirException.cpp @ 47:491a97842e31

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Sep 2012 13:26:06 +0200
parents Core/PalantirException.cpp@3959d33612cc
children a15e90e5d6fc
comparison
equal deleted inserted replaced
45:33d67e1ab173 47:491a97842e31
1 /**
2 * Palantir - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
4 * Belgium
5 *
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
20
21 #include "PalantirException.h"
22
23 namespace Palantir
24 {
25 const char* PalantirException::What() const
26 {
27 if (error_ == ErrorCode_Custom)
28 {
29 return custom_.c_str();
30 }
31 else
32 {
33 return GetDescription(error_);
34 }
35 }
36
37
38 const char* PalantirException::GetDescription(ErrorCode error)
39 {
40 switch (error)
41 {
42 case ErrorCode_Success:
43 return "Success";
44
45 case ErrorCode_ParameterOutOfRange:
46 return "Parameter out of range";
47
48 case ErrorCode_NotImplemented:
49 return "Not implemented yet";
50
51 case ErrorCode_InternalError:
52 return "Internal error";
53
54 case ErrorCode_NotEnoughMemory:
55 return "Not enough memory";
56
57 case ErrorCode_UriSyntax:
58 return "Badly formatted URI";
59
60 case ErrorCode_BadParameterType:
61 return "Bad type for a parameter";
62
63 case ErrorCode_InexistentFile:
64 return "Inexistent file";
65
66 case ErrorCode_BadFileFormat:
67 return "Bad file format";
68
69 case ErrorCode_CannotWriteFile:
70 return "Cannot write to file";
71
72 case ErrorCode_Custom:
73 default:
74 return "???";
75 }
76 }
77 }