Mercurial > hg > orthanc
annotate Core/OrthancException.cpp @ 892:517e28b420af plugins
integration mainline -> plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 16 Jun 2014 15:41:13 +0200 |
parents | 0570a8c859cb |
children | 64f1842aae2e |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
689 | 3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, |
0 | 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. | |
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 |
252 | 127 case ErrorCode_Custom: |
128 default: | |
129 return "???"; | |
0 | 130 } |
131 } | |
132 } |