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