Mercurial > hg > orthanc
comparison Core/Enumerations.cpp @ 1575:f8aae45011c9
exceptions now carry HTTP status
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2015 14:00:57 +0200 |
parents | 904096e7367e |
children | de54c19fc44d |
comparison
equal
deleted
inserted
replaced
1574:0c29ebe80ac9 | 1575:f8aae45011c9 |
---|---|
38 | 38 |
39 #include <string.h> | 39 #include <string.h> |
40 | 40 |
41 namespace Orthanc | 41 namespace Orthanc |
42 { | 42 { |
43 const char* EnumerationToString(ErrorCode error) | |
44 { | |
45 switch (error) | |
46 { | |
47 case ErrorCode_Success: | |
48 return "Success"; | |
49 | |
50 case ErrorCode_Custom: | |
51 return "Custom error, see the attached error message"; | |
52 | |
53 case ErrorCode_InternalError: | |
54 return "Internal error"; | |
55 | |
56 case ErrorCode_NotImplemented: | |
57 return "Not implemented yet"; | |
58 | |
59 case ErrorCode_ParameterOutOfRange: | |
60 return "Parameter out of range"; | |
61 | |
62 case ErrorCode_NotEnoughMemory: | |
63 return "Not enough memory"; | |
64 | |
65 case ErrorCode_BadParameterType: | |
66 return "Bad type for a parameter"; | |
67 | |
68 case ErrorCode_BadSequenceOfCalls: | |
69 return "Bad sequence of calls"; | |
70 | |
71 case ErrorCode_UriSyntax: | |
72 return "Badly formatted URI"; | |
73 | |
74 case ErrorCode_InexistentFile: | |
75 return "Inexistent file"; | |
76 | |
77 case ErrorCode_BadFileFormat: | |
78 return "Bad file format"; | |
79 | |
80 case ErrorCode_CannotWriteFile: | |
81 return "Cannot write to file"; | |
82 | |
83 case ErrorCode_Timeout: | |
84 return "Timeout"; | |
85 | |
86 case ErrorCode_UnknownResource: | |
87 return "Unknown resource"; | |
88 | |
89 case ErrorCode_IncompatibleDatabaseVersion: | |
90 return "Incompatible version of the database"; | |
91 | |
92 case ErrorCode_FullStorage: | |
93 return "The file storage is full"; | |
94 | |
95 case ErrorCode_InexistentItem: | |
96 return "Accessing an inexistent item"; | |
97 | |
98 case ErrorCode_BadRequest: | |
99 return "Bad request"; | |
100 | |
101 case ErrorCode_NetworkProtocol: | |
102 return "Error in the network protocol"; | |
103 | |
104 case ErrorCode_CorruptedFile: | |
105 return "Corrupted file (inconsistent MD5 hash)"; | |
106 | |
107 case ErrorCode_InexistentTag: | |
108 return "Inexistent tag"; | |
109 | |
110 case ErrorCode_ReadOnly: | |
111 return "Cannot modify a read-only data structure"; | |
112 | |
113 case ErrorCode_IncompatibleImageSize: | |
114 return "Incompatible size of the images"; | |
115 | |
116 case ErrorCode_IncompatibleImageFormat: | |
117 return "Incompatible format of the images"; | |
118 | |
119 case ErrorCode_SharedLibrary: | |
120 return "Error while using a shared library (plugin)"; | |
121 | |
122 case ErrorCode_SystemCommand: | |
123 return "Error while calling a system command"; | |
124 | |
125 case ErrorCode_Plugin: | |
126 return "Error encountered inside a plugin"; | |
127 | |
128 case ErrorCode_Database: | |
129 return "Error with the database engine"; | |
130 | |
131 default: | |
132 return "Unknown error code"; | |
133 } | |
134 } | |
135 | |
136 | |
43 const char* EnumerationToString(HttpMethod method) | 137 const char* EnumerationToString(HttpMethod method) |
44 { | 138 { |
45 switch (method) | 139 switch (method) |
46 { | 140 { |
47 case HttpMethod_Get: | 141 case HttpMethod_Get: |