changeset 6417:bbeacd71831b

rollback enum LogException
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 15 Nov 2025 10:34:10 +0100
parents 68001db8ed4a
children 5a8dd2508358
files OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp OrthancFramework/Sources/OrthancException.cpp OrthancFramework/Sources/OrthancException.h OrthancFramework/Sources/SystemToolbox.cpp OrthancServer/Plugins/Engine/OrthancPlugins.cpp
diffstat 7 files changed, 12 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Sat Nov 15 10:34:10 2025 +0100
@@ -255,7 +255,7 @@
       
       if (existingLevelTags.find(tag) != existingLevelTags.end())
       {
-        throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined", LogException_No);
+        throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined", false);
       }
 
       if (level == ResourceType_Study) // all patients main dicom tags are also copied at study level
@@ -264,7 +264,7 @@
         
         if (patientLevelTags.find(tag) != patientLevelTags.end())
         {
-          throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined", LogException_No);
+          throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined", false);
         }
       }
 
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Sat Nov 15 10:34:10 2025 +0100
@@ -1409,7 +1409,7 @@
       }
 
       CLOG(INFO, DICOM) << "Unknown DICOM tag: \"" << name << "\"";
-      throw OrthancException(ErrorCode_UnknownDicomTag, name, LogException_No);
+      throw OrthancException(ErrorCode_UnknownDicomTag, name, false);
     }
 #endif
   }
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Sat Nov 15 10:34:10 2025 +0100
@@ -966,12 +966,12 @@
     {
       throw OrthancException(ErrorCode_NotImplemented,
                              "The built-in DCMTK decoder cannot decode some DICOM instance "
-                             "whose transfer syntax is: " + std::string(GetTransferSyntaxUid(s)), LogException_No);
+                             "whose transfer syntax is: " + std::string(GetTransferSyntaxUid(s)), false);
     }
     else
     {
       throw OrthancException(ErrorCode_NotImplemented,
-                             "The built-in DCMTK decoder cannot decode some DICOM instance", LogException_No);
+                             "The built-in DCMTK decoder cannot decode some DICOM instance", false);
     }
   }
 
--- a/OrthancFramework/Sources/OrthancException.cpp	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancFramework/Sources/OrthancException.cpp	Sat Nov 15 10:34:10 2025 +0100
@@ -132,14 +132,14 @@
 
   OrthancException::OrthancException(ErrorCode errorCode,
                                      const std::string& details,
-                                     LogException log) :
+                                     bool log) :
     errorCode_(errorCode),
     httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)),
-    logged_(log == LogException_Yes),
+    logged_(log),
     details_(new std::string(details))
   {
 #if ORTHANC_ENABLE_LOGGING == 1
-    if (log == LogException_Yes)
+    if (log)
     {
       LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details;
     }
--- a/OrthancFramework/Sources/OrthancException.h	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancFramework/Sources/OrthancException.h	Sat Nov 15 10:34:10 2025 +0100
@@ -33,17 +33,6 @@
 
 namespace Orthanc
 {
-  // From 1.12.10, we use this enumeration instead of a bool to avoid implicit
-  // conversions to bool in OrthancException constructors because any type is
-  // automaticaly casted to a bool without a single warning which led to wrong 
-  // constructor flavors being called.
-  enum ORTHANC_PUBLIC LogException
-    {
-      LogException_Yes,
-      LogException_No
-    };
-
-
   class ORTHANC_PUBLIC ErrorPayload
   {
   private:
@@ -104,7 +93,7 @@
 
     OrthancException(ErrorCode errorCode,
                      const std::string& details,
-                     LogException log = LogException_Yes);
+                     bool log = true);
 
     ErrorCode GetErrorCode() const;
 
--- a/OrthancFramework/Sources/SystemToolbox.cpp	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancFramework/Sources/SystemToolbox.cpp	Sat Nov 15 10:34:10 2025 +0100
@@ -228,8 +228,7 @@
     if (!IsRegularFile(path))
     {
       throw OrthancException(ErrorCode_RegularFileExpected,
-                             "The path does not point to a regular file: " + PathToUtf8(path),
-                             (log ? LogException_Yes : LogException_No));
+                             "The path does not point to a regular file: " + PathToUtf8(path), log);
     }
 
     try
@@ -238,8 +237,7 @@
       f.open(path, std::ifstream::in | std::ifstream::binary);
       if (!f.good())
       {
-        throw OrthancException(ErrorCode_InexistentFile, "File not found: " + PathToUtf8(path),
-                               (log ? LogException_Yes : LogException_No));
+        throw OrthancException(ErrorCode_InexistentFile, "File not found: " + PathToUtf8(path), log);
       }
 
       std::streamsize size = GetStreamSize(f);
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Sat Nov 15 10:24:55 2025 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Sat Nov 15 10:34:10 2025 +0100
@@ -1453,9 +1453,7 @@
 
           if (HasErrorDetails())
           {
-            throw OrthancException(static_cast<ErrorCode>(error),
-                                   GetErrorDetails(),
-                                   (IsLogDetails() ? LogException_Yes : LogException_No));
+            throw OrthancException(static_cast<ErrorCode>(error), GetErrorDetails(), IsLogDetails());
           }
           else
           {