Mercurial > hg > orthanc
annotate Core/OrthancException.cpp @ 1572:904096e7367e
More information about the origin request in OnStoredInstance() callbacks
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2015 12:10:12 +0200 |
parents | 818ae9bc493a |
children | f8aae45011c9 |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1248
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1248
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
0 | 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. | |
136 | 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. | |
0 | 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 | |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
33 #include "PrecompiledHeaders.h" |
59 | 34 #include "OrthancException.h" |
0 | 35 |
59 | 36 namespace Orthanc |
0 | 37 { |
59 | 38 const char* OrthancException::What() const |
0 | 39 { |
40 if (error_ == ErrorCode_Custom) | |
41 { | |
42 return custom_.c_str(); | |
43 } | |
44 else | |
45 { | |
46 return GetDescription(error_); | |
47 } | |
48 } | |
49 | |
50 | |
59 | 51 const char* OrthancException::GetDescription(ErrorCode error) |
0 | 52 { |
53 switch (error) | |
54 { | |
252 | 55 case ErrorCode_Success: |
56 return "Success"; | |
0 | 57 |
252 | 58 case ErrorCode_ParameterOutOfRange: |
59 return "Parameter out of range"; | |
0 | 60 |
252 | 61 case ErrorCode_NotImplemented: |
62 return "Not implemented yet"; | |
0 | 63 |
252 | 64 case ErrorCode_InternalError: |
65 return "Internal error"; | |
0 | 66 |
252 | 67 case ErrorCode_NotEnoughMemory: |
68 return "Not enough memory"; | |
0 | 69 |
252 | 70 case ErrorCode_UriSyntax: |
71 return "Badly formatted URI"; | |
0 | 72 |
252 | 73 case ErrorCode_BadParameterType: |
74 return "Bad type for a parameter"; | |
0 | 75 |
252 | 76 case ErrorCode_InexistentFile: |
77 return "Inexistent file"; | |
78 | |
79 case ErrorCode_BadFileFormat: | |
80 return "Bad file format"; | |
0 | 81 |
252 | 82 case ErrorCode_CannotWriteFile: |
83 return "Cannot write to file"; | |
0 | 84 |
252 | 85 case ErrorCode_Timeout: |
86 return "Timeout"; | |
0 | 87 |
252 | 88 case ErrorCode_UnknownResource: |
89 return "Unknown resource"; | |
140 | 90 |
252 | 91 case ErrorCode_BadSequenceOfCalls: |
92 return "Bad sequence of calls"; | |
198
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
93 |
252 | 94 case ErrorCode_IncompatibleDatabaseVersion: |
95 return "Incompatible version of the database"; | |
211 | 96 |
268
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
97 case ErrorCode_FullStorage: |
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
98 return "The file storage is full"; |
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
99 |
282 | 100 case ErrorCode_InexistentItem: |
101 return "Accessing an inexistent item"; | |
102 | |
304 | 103 case ErrorCode_BadRequest: |
104 return "Bad request"; | |
105 | |
459 | 106 case ErrorCode_NetworkProtocol: |
107 return "Error in the network protocol"; | |
108 | |
693
01d8611c4a60
md5 for attached files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
109 case ErrorCode_CorruptedFile: |
01d8611c4a60
md5 for attached files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
110 return "Corrupted file (inconsistent MD5 hash)"; |
01d8611c4a60
md5 for attached files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
111 |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
112 case ErrorCode_InexistentTag: |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
113 return "Inexistent tag"; |
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
114 |
797
37adac56017a
ImageAccessor abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
115 case ErrorCode_ReadOnly: |
37adac56017a
ImageAccessor abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
116 return "Cannot modify a read-only data structure"; |
37adac56017a
ImageAccessor abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
117 |
853
839be3022203
DicomImageInformation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
118 case ErrorCode_IncompatibleImageSize: |
839be3022203
DicomImageInformation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
119 return "Incompatible size of the images"; |
839be3022203
DicomImageInformation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
120 |
839be3022203
DicomImageInformation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
121 case ErrorCode_IncompatibleImageFormat: |
839be3022203
DicomImageInformation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
122 return "Incompatible format of the images"; |
839be3022203
DicomImageInformation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
123 |
885
0570a8c859cb
SharedLibrary class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
853
diff
changeset
|
124 case ErrorCode_SharedLibrary: |
0570a8c859cb
SharedLibrary class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
853
diff
changeset
|
125 return "Error while using a shared library (plugin)"; |
0570a8c859cb
SharedLibrary class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
853
diff
changeset
|
126 |
1050
64f1842aae2e
Toolbox::ExecuteSystemCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
885
diff
changeset
|
127 case ErrorCode_SystemCommand: |
64f1842aae2e
Toolbox::ExecuteSystemCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
885
diff
changeset
|
128 return "Error while calling a system command"; |
64f1842aae2e
Toolbox::ExecuteSystemCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
885
diff
changeset
|
129 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1050
diff
changeset
|
130 case ErrorCode_Plugin: |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1050
diff
changeset
|
131 return "Error encountered inside a plugin"; |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1050
diff
changeset
|
132 |
1248
db753e57934f
ErrorCode_Database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
133 case ErrorCode_Database: |
db753e57934f
ErrorCode_Database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
134 return "Error with the database engine"; |
db753e57934f
ErrorCode_Database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
135 |
252 | 136 case ErrorCode_Custom: |
1568 | 137 return "See the attached error message"; |
138 | |
252 | 139 default: |
1568 | 140 return "Unknown error code"; |
0 | 141 } |
142 } | |
143 } |