Mercurial > hg > orthanc-stone
diff Framework/StoneException.h @ 1036:d7d3227c11a9
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 07 Oct 2019 15:26:29 +0200 |
parents | e160159b1905 |
children | efc5b62b9539 |
line wrap: on
line diff
--- a/Framework/StoneException.h Mon Oct 07 15:26:16 2019 +0200 +++ b/Framework/StoneException.h Mon Oct 07 15:26:29 2019 +0200 @@ -58,6 +58,8 @@ { } + virtual ~StoneException() {} + ErrorCode GetErrorCode() const { return errorCode_; @@ -111,6 +113,7 @@ { protected: int applicationErrorCode_; + mutable std::string errorMessage_; public: explicit StoneApplicationException(int applicationErrorCode) : @@ -126,7 +129,10 @@ virtual const char* What() const { - return boost::lexical_cast<std::string>(applicationErrorCode_).c_str(); + if (errorMessage_.size() == 0) + errorMessage_ = boost::lexical_cast<std::string>(applicationErrorCode_); + + return errorMessage_.c_str(); } }; }