comparison Core/OrthancException.h @ 1583:9ea3d082b064

got rid of custom exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 17:52:50 +0200
parents bd1889029cbb
children 87c77b9b3679
comparison
equal deleted inserted replaced
1582:bd1889029cbb 1583:9ea3d082b064
40 class OrthancException 40 class OrthancException
41 { 41 {
42 protected: 42 protected:
43 ErrorCode errorCode_; 43 ErrorCode errorCode_;
44 HttpStatus httpStatus_; 44 HttpStatus httpStatus_;
45 std::string custom_;
46
47 OrthancException(const std::string& custom) :
48 errorCode_(ErrorCode_Custom),
49 httpStatus_(HttpStatus_500_InternalServerError),
50 custom_(custom)
51 {
52 }
53 45
54 public: 46 public:
55 OrthancException(ErrorCode errorCode) : 47 OrthancException(ErrorCode errorCode) :
56 errorCode_(errorCode), 48 errorCode_(errorCode),
57 httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)) 49 httpStatus_(ConvertErrorCodeToHttpStatus(errorCode))
75 return httpStatus_; 67 return httpStatus_;
76 } 68 }
77 69
78 const char* What() const 70 const char* What() const
79 { 71 {
80 if (errorCode_ == ErrorCode_Custom) 72 return EnumerationToString(errorCode_);
81 {
82 return custom_.c_str();
83 }
84 else
85 {
86 return EnumerationToString(errorCode_);
87 }
88 } 73 }
89 }; 74 };
90 } 75 }