# HG changeset patch # User Sebastien Jodogne # Date 1786689458 -7200 # Node ID 247101bd4e74259ba9864c3715a5f55582ac2352 # Parent 73775b15af9cad6d51452f0857f284b06bc1dfd7 replace exceptions by assert() in debug mode for logging diff -r 73775b15af9c -r 247101bd4e74 OrthancFramework/Sources/Logging.cpp --- a/OrthancFramework/Sources/Logging.cpp Fri Aug 14 08:05:15 2026 +0200 +++ b/OrthancFramework/Sources/Logging.cpp Fri Aug 14 08:37:38 2026 +0200 @@ -662,10 +662,9 @@ #if !defined(NDEBUG) if (hasName_) { - throw Orthanc::OrthancException( - Orthanc::ErrorCode_InternalError, "This thread already has a name or another thread is re-using " - "the same threadId and you have not called 'ClearCurrentThreadName()': " + name, - false /* don't log to avoid deadlock */); + std::cerr << "This thread already has a name or another thread is re-using " + << "the same threadId and you have not called \"ClearCurrentThreadName()\": " << name << std::endl; + assert(0); } #endif @@ -703,8 +702,8 @@ if (context_.empty()) { #if !defined(NDEBUG) - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Cannot pop from an empty context", - false /* don't log to avoid deadlock */); + std::cerr << "Cannot pop from an empty context" << std::endl; + assert(0); #endif } else @@ -892,9 +891,8 @@ it->second->HasThreadName() && it->second->GetThreadName() == formattedName) { - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, - "Another thread already uses this thread name: " + name, - false /* don't log to avoid deadlock */); + std::cerr << "Another thread already uses this thread name: " << name << std::endl; + assert(0); } } #endif