comparison Orthanc/Core/OrthancException.cpp @ 3:d5027f9f676a

fix build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Jun 2015 15:12:22 +0200
parents
children e59bf2554e59
comparison
equal deleted inserted replaced
2:8f22ed9d48d5 3:d5027f9f676a
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, 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 * In addition, as a special exception, the copyright holders of this
12 * program give permission to link the code of its release with the
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
14 * that use the same license as the "OpenSSL" library), and distribute
15 * the linked executables. You must obey the GNU General Public License
16 * in all respects for all of the code used other than "OpenSSL". If you
17 * modify file(s) with this exception, you may extend this exception to
18 * your version of the file(s), but you are not obligated to do so. If
19 * you do not wish to do so, delete this exception statement from your
20 * version. If you delete this exception statement from all source files
21 * in the program, then also delete it here.
22 *
23 * This program is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 **/
31
32
33 #include "PrecompiledHeaders.h"
34 #include "OrthancException.h"
35
36 namespace Orthanc
37 {
38 const char* OrthancException::What() const
39 {
40 if (error_ == ErrorCode_Custom)
41 {
42 return custom_.c_str();
43 }
44 else
45 {
46 return GetDescription(error_);
47 }
48 }
49
50
51 const char* OrthancException::GetDescription(ErrorCode error)
52 {
53 switch (error)
54 {
55 case ErrorCode_Success:
56 return "Success";
57
58 case ErrorCode_ParameterOutOfRange:
59 return "Parameter out of range";
60
61 case ErrorCode_NotImplemented:
62 return "Not implemented yet";
63
64 case ErrorCode_InternalError:
65 return "Internal error";
66
67 case ErrorCode_NotEnoughMemory:
68 return "Not enough memory";
69
70 case ErrorCode_UriSyntax:
71 return "Badly formatted URI";
72
73 case ErrorCode_BadParameterType:
74 return "Bad type for a parameter";
75
76 case ErrorCode_InexistentFile:
77 return "Inexistent file";
78
79 case ErrorCode_BadFileFormat:
80 return "Bad file format";
81
82 case ErrorCode_CannotWriteFile:
83 return "Cannot write to file";
84
85 case ErrorCode_Timeout:
86 return "Timeout";
87
88 case ErrorCode_UnknownResource:
89 return "Unknown resource";
90
91 case ErrorCode_BadSequenceOfCalls:
92 return "Bad sequence of calls";
93
94 case ErrorCode_IncompatibleDatabaseVersion:
95 return "Incompatible version of the database";
96
97 case ErrorCode_FullStorage:
98 return "The file storage is full";
99
100 case ErrorCode_InexistentItem:
101 return "Accessing an inexistent item";
102
103 case ErrorCode_BadRequest:
104 return "Bad request";
105
106 case ErrorCode_NetworkProtocol:
107 return "Error in the network protocol";
108
109 case ErrorCode_CorruptedFile:
110 return "Corrupted file (inconsistent MD5 hash)";
111
112 case ErrorCode_InexistentTag:
113 return "Inexistent tag";
114
115 case ErrorCode_ReadOnly:
116 return "Cannot modify a read-only data structure";
117
118 case ErrorCode_IncompatibleImageSize:
119 return "Incompatible size of the images";
120
121 case ErrorCode_IncompatibleImageFormat:
122 return "Incompatible format of the images";
123
124 case ErrorCode_SharedLibrary:
125 return "Error while using a shared library (plugin)";
126
127 case ErrorCode_SystemCommand:
128 return "Error while calling a system command";
129
130 case ErrorCode_Plugin:
131 return "Error encountered inside a plugin";
132
133 case ErrorCode_Database:
134 return "Error with the database engine";
135
136 case ErrorCode_Custom:
137 default:
138 return "???";
139 }
140 }
141 }