diff OrthancFramework/Sources/OrthancException.cpp @ 5100:9d51c000e91a

more verbose HTTPClient errors + avoid duplicate logging of same error
author Alain Mazy <am@osimis.io>
date Wed, 19 Oct 2022 12:40:14 +0200
parents 43e613a7756b
children 0ea402b4d901
line wrap: on
line diff
--- a/OrthancFramework/Sources/OrthancException.cpp	Wed Oct 19 08:57:34 2022 +0200
+++ b/OrthancFramework/Sources/OrthancException.cpp	Wed Oct 19 12:40:14 2022 +0200
@@ -31,7 +31,8 @@
 {
   OrthancException::OrthancException(const OrthancException& other) : 
     errorCode_(other.errorCode_),
-    httpStatus_(other.httpStatus_)
+    httpStatus_(other.httpStatus_),
+    logged_(false)
   {
     if (other.details_.get() != NULL)
     {
@@ -41,7 +42,8 @@
 
   OrthancException::OrthancException(ErrorCode errorCode) : 
     errorCode_(errorCode),
-    httpStatus_(ConvertErrorCodeToHttpStatus(errorCode))
+    httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)),
+    logged_(false)
   {
   }
 
@@ -50,6 +52,7 @@
                                      bool log) :
     errorCode_(errorCode),
     httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)),
+    logged_(log),
     details_(new std::string(details))
   {
 #if ORTHANC_ENABLE_LOGGING == 1
@@ -63,7 +66,8 @@
   OrthancException::OrthancException(ErrorCode errorCode,
                                      HttpStatus httpStatus) :
     errorCode_(errorCode),
-    httpStatus_(httpStatus)
+    httpStatus_(httpStatus),
+    logged_(false)
   {
   }
 
@@ -73,6 +77,7 @@
                                      bool log) :
     errorCode_(errorCode),
     httpStatus_(httpStatus),
+    logged_(log),
     details_(new std::string(details))
   {
 #if ORTHANC_ENABLE_LOGGING == 1
@@ -114,4 +119,10 @@
       return details_->c_str();
     }
   }
+
+  bool OrthancException::HasBeenLogged() const
+  {
+    return logged_;
+  }
+
 }