Mercurial > hg > orthanc
comparison Core/OrthancException.h @ 1644:939b921b2c81
plugin error dictionary
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Sep 2015 22:05:27 +0200 |
parents | 87c77b9b3679 |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1643:87c77b9b3679 | 1644:939b921b2c81 |
---|---|
41 class OrthancException | 41 class OrthancException |
42 { | 42 { |
43 protected: | 43 protected: |
44 ErrorCode errorCode_; | 44 ErrorCode errorCode_; |
45 HttpStatus httpStatus_; | 45 HttpStatus httpStatus_; |
46 int32_t pluginCode_; | |
47 | |
48 OrthancException(ErrorCode errorCode, | |
49 HttpStatus httpStatus, | |
50 int32_t pluginCode) : | |
51 errorCode_(errorCode), | |
52 httpStatus_(httpStatus), | |
53 pluginCode_(0) | |
54 { | |
55 } | |
56 | 46 |
57 public: | 47 public: |
58 OrthancException(ErrorCode errorCode) : | 48 OrthancException(ErrorCode errorCode) : |
59 errorCode_(errorCode), | 49 errorCode_(errorCode), |
60 httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)), | 50 httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)) |
61 pluginCode_(0) | |
62 { | 51 { |
63 } | 52 } |
64 | 53 |
65 OrthancException(ErrorCode errorCode, | 54 OrthancException(ErrorCode errorCode, |
66 HttpStatus httpStatus) : | 55 HttpStatus httpStatus) : |
67 errorCode_(errorCode), | 56 errorCode_(errorCode), |
68 httpStatus_(httpStatus), | 57 httpStatus_(httpStatus) |
69 pluginCode_(0) | |
70 { | 58 { |
71 } | |
72 | |
73 static OrthancException GetPluginException(int32_t pluginCode, | |
74 HttpStatus httpStatus) | |
75 { | |
76 return OrthancException(ErrorCode_Plugin, httpStatus, pluginCode); | |
77 } | 59 } |
78 | 60 |
79 ErrorCode GetErrorCode() const | 61 ErrorCode GetErrorCode() const |
80 { | 62 { |
81 return errorCode_; | 63 return errorCode_; |
84 HttpStatus GetHttpStatus() const | 66 HttpStatus GetHttpStatus() const |
85 { | 67 { |
86 return httpStatus_; | 68 return httpStatus_; |
87 } | 69 } |
88 | 70 |
89 int32_t GetPluginErrorCode() const | |
90 { | |
91 return pluginCode_; | |
92 } | |
93 | |
94 const char* What() const | 71 const char* What() const |
95 { | 72 { |
96 return EnumerationToString(errorCode_); | 73 return EnumerationToString(errorCode_); |
97 } | 74 } |
98 }; | 75 }; |