# HG changeset patch # User Sebastien Jodogne # Date 1763199250 -3600 # Node ID bbeacd71831b1ed238edb37497a171dd25a32d51 # Parent 68001db8ed4a54d2015e8ceabd7eec3d152681be rollback enum LogException diff -r 68001db8ed4a -r bbeacd71831b OrthancFramework/Sources/DicomFormat/DicomMap.cpp --- 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); } } diff -r 68001db8ed4a -r bbeacd71831b OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- 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 } diff -r 68001db8ed4a -r bbeacd71831b OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp --- 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); } } diff -r 68001db8ed4a -r bbeacd71831b OrthancFramework/Sources/OrthancException.cpp --- 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; } diff -r 68001db8ed4a -r bbeacd71831b OrthancFramework/Sources/OrthancException.h --- 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; diff -r 68001db8ed4a -r bbeacd71831b OrthancFramework/Sources/SystemToolbox.cpp --- 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); diff -r 68001db8ed4a -r bbeacd71831b OrthancServer/Plugins/Engine/OrthancPlugins.cpp --- 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(error), - GetErrorDetails(), - (IsLogDetails() ? LogException_Yes : LogException_No)); + throw OrthancException(static_cast(error), GetErrorDetails(), IsLogDetails()); } else {