comparison Core/OrthancException.h @ 1576:de54c19fc44d

refactoring OrthancException
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 14:48:06 +0200
parents f8aae45011c9
children 7aac0cddd42e
comparison
equal deleted inserted replaced
1575:f8aae45011c9 1576:de54c19fc44d
59 httpStatus_(HttpStatus_500_InternalServerError), 59 httpStatus_(HttpStatus_500_InternalServerError),
60 custom_(custom) 60 custom_(custom)
61 { 61 {
62 } 62 }
63 63
64 OrthancException(ErrorCode errorCode); 64 OrthancException(ErrorCode errorCode) :
65 errorCode_(errorCode),
66 httpStatus_(ConvertErrorCodeToHttpStatus(errorCode))
67 {
68 }
65 69
66 OrthancException(ErrorCode errorCode, 70 OrthancException(ErrorCode errorCode,
67 HttpStatus httpStatus) : 71 HttpStatus httpStatus) :
68 errorCode_(errorCode), 72 errorCode_(errorCode),
69 httpStatus_(httpStatus) 73 httpStatus_(httpStatus)
78 HttpStatus GetHttpStatus() const 82 HttpStatus GetHttpStatus() const
79 { 83 {
80 return httpStatus_; 84 return httpStatus_;
81 } 85 }
82 86
83 const char* What() const; 87 const char* What() const
88 {
89 if (errorCode_ == ErrorCode_Custom)
90 {
91 return custom_.c_str();
92 }
93 else
94 {
95 return EnumerationToString(errorCode_);
96 }
97 }
84 }; 98 };
85 } 99 }