annotate Orthanc/Core/OrthancException.cpp @ 56:b7bc8509cbcc

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