changeset 1033:e160159b1905 toa2019100702

Fixed buggy return of stack data
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 07 Oct 2019 15:09:37 +0200
parents 43bf09d73e03
children 839d2bff92ab
files Framework/StoneException.h
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/StoneException.h	Mon Oct 07 14:09:44 2019 +0200
+++ b/Framework/StoneException.h	Mon Oct 07 15:09:37 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();
     }
   };
 }