changeset 6907:91a63f8a96ec

Use THROW_WITH_FILE_AND_LINE_INFO to identify the origin of NotImplemented and InternalError that do not have error details
author Alain Mazy <am@orthanc.team>
date Tue, 02 Jun 2026 12:44:19 +0200
parents 8327b8597b93
children 31641dd2247a
files OrthancFramework/Sources/ChunkedBuffer.cpp OrthancFramework/Sources/Compression/GzipCompressor.cpp OrthancFramework/Sources/Compression/ZipReader.cpp OrthancFramework/Sources/Compression/ZlibCompressor.cpp OrthancFramework/Sources/DataSource/DataSourceAnswer.cpp OrthancFramework/Sources/DataSource/DataSourceReader.cpp OrthancFramework/Sources/DataSource/DicomDataSource.cpp OrthancFramework/Sources/DataSource/StorageAreaDataSource.cpp OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp OrthancFramework/Sources/DicomFormat/DicomValue.cpp OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp OrthancFramework/Sources/DicomNetworking/DicomConnectionInfo.cpp OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp OrthancFramework/Sources/DicomNetworking/DicomStoreUserConnection.cpp OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp OrthancFramework/Sources/DicomParsing/DicomModification.cpp OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp OrthancFramework/Sources/DicomParsing/Internals/SopInstanceUidFixer.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp OrthancFramework/Sources/Enumerations.cpp OrthancFramework/Sources/FileStorage/MemoryStorageArea.cpp OrthancFramework/Sources/FileStorage/StorageAccessor.cpp OrthancFramework/Sources/HttpClient.cpp OrthancFramework/Sources/HttpServer/HttpOutput.cpp OrthancFramework/Sources/HttpServer/HttpServer.cpp OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.cpp OrthancFramework/Sources/HttpServer/WebDavStorage.cpp OrthancFramework/Sources/Images/Font.cpp OrthancFramework/Sources/Images/ImageAccessor.cpp OrthancFramework/Sources/Images/ImageProcessing.cpp OrthancFramework/Sources/Images/JpegReader.cpp OrthancFramework/Sources/Images/JpegWriter.cpp OrthancFramework/Sources/Images/NumpyWriter.cpp OrthancFramework/Sources/Images/PamReader.cpp OrthancFramework/Sources/Images/PamWriter.cpp OrthancFramework/Sources/Images/PngReader.cpp OrthancFramework/Sources/Images/PngWriter.cpp OrthancFramework/Sources/JobsEngine/JobsEngine.cpp OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.cpp OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.h OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp OrthancFramework/Sources/Logging.cpp OrthancFramework/Sources/MallocMemoryBuffer.cpp OrthancFramework/Sources/MetricsRegistry.cpp OrthancFramework/Sources/MultiThreading/FutureState.cpp OrthancFramework/Sources/MultiThreading/ThreadPool.cpp OrthancFramework/Sources/RestApi/RestApi.cpp OrthancFramework/Sources/SharedLibrary.cpp OrthancFramework/Sources/Toolbox.cpp OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp OrthancFramework/UnitTestsSources/JobsTests.cpp OrthancFramework/UnitTestsSources/RestApiTests.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Plugins/Engine/PluginsJob.h OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp OrthancServer/Sources/Database/Compatibility/GenericFind.cpp OrthancServer/Sources/Database/Compatibility/ILookupResourceAndParent.cpp OrthancServer/Sources/Database/Compatibility/SetOfResources.cpp OrthancServer/Sources/Database/FindResponse.cpp OrthancServer/Sources/Database/ResourcesContent.cpp OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/VoidDatabaseListener.cpp OrthancServer/Sources/DicomInstanceOrigin.cpp OrthancServer/Sources/ExportedResource.cpp OrthancServer/Sources/LuaScripting.cpp OrthancServer/Sources/OrthancFindRequestHandler.cpp OrthancServer/Sources/OrthancGetRequestHandler.cpp OrthancServer/Sources/OrthancHttpHandler.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/Sources/OrthancWebDav.cpp OrthancServer/Sources/ResourceFinder.cpp OrthancServer/Sources/Search/DatabaseDicomTagConstraints.cpp OrthancServer/Sources/Search/DicomTagConstraint.cpp OrthancServer/Sources/Search/HierarchicalMatcher.cpp OrthancServer/Sources/Search/ISqlLookupFormatter.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerIndex.cpp OrthancServer/Sources/ServerJobs/ArchiveJob.cpp OrthancServer/Sources/ServerJobs/CleaningInstancesJob.cpp OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp OrthancServer/Sources/ServerJobs/Operations/ModifyInstanceOperation.cpp OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp OrthancServer/Sources/ServerJobs/ThreadedSetOfInstancesJob.cpp OrthancServer/Sources/StorageCommitmentReports.cpp OrthancServer/Sources/main.cpp OrthancServer/UnitTestsSources/ServerIndexTests.cpp OrthancServer/UnitTestsSources/ServerJobsTests.cpp
diffstat 115 files changed, 451 insertions(+), 451 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/ChunkedBuffer.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/ChunkedBuffer.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -188,7 +188,7 @@
     {
       if (numBytes_ != 0)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       result.clear();
@@ -199,7 +199,7 @@
       assert(chunks_.front() != NULL);
       if (chunks_.front()->size() != numBytes_)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else
       {
--- a/OrthancFramework/Sources/Compression/GzipCompressor.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Compression/GzipCompressor.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -143,7 +143,7 @@
     {
       // Cannot initialize zlib
       compressed.clear();
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     // Compress the input buffer
@@ -160,7 +160,7 @@
         throw OrthancException(ErrorCode_NotEnoughMemory);
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }  
     }
 
@@ -168,7 +168,7 @@
 
     if (deflateEnd(&stream) != Z_OK)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     // The compression was successful
@@ -293,7 +293,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError); // Unknown error
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError); // Unknown error
         }
 
         const size_t produced = chunk.size() - stream.avail_out;
--- a/OrthancFramework/Sources/Compression/ZipReader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Compression/ZipReader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -473,7 +473,7 @@
       reader->pimpl_->reader_.reset(new MemoryBuffer(buffer, size));
       if (reader->pimpl_->reader_.get() == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     
       zlib_filefunc64_def funcs;
--- a/OrthancFramework/Sources/Compression/ZlibCompressor.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Compression/ZlibCompressor.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -85,7 +85,7 @@
         throw OrthancException(ErrorCode_NotEnoughMemory);
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }  
     }
 
@@ -157,7 +157,7 @@
         throw OrthancException(ErrorCode_NotEnoughMemory);
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }  
     }
   }
--- a/OrthancFramework/Sources/DataSource/DataSourceAnswer.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DataSourceAnswer.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -91,7 +91,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
--- a/OrthancFramework/Sources/DataSource/DataSourceReader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DataSourceReader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -116,7 +116,7 @@
       }
       catch (...)
       {
-        error.reset(new OrthancException(ErrorCode_InternalError));
+        error.reset(new OrthancException(ErrorCode_InternalError, "Unknown exception in Datasource::Run"));
       }
 
       // Phase 2: Acquire budget WITHOUT holding a strong reference to "DataSourceAnswer".
--- a/OrthancFramework/Sources/DataSource/DicomDataSource.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DicomDataSource.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -249,7 +249,7 @@
 
       if (!ok)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
--- a/OrthancFramework/Sources/DataSource/StorageAreaDataSource.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/StorageAreaDataSource.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -252,7 +252,7 @@
         }
 
         default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
     else
--- a/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -184,11 +184,11 @@
     }
     catch (boost::bad_lexical_cast&)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
     catch (OrthancException&)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     
@@ -196,7 +196,7 @@
     {
       if (!values.ParseUnsignedInteger32(numberOfFrames_, DICOM_TAG_NUMBER_OF_FRAMES))
       {
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
     else
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -245,7 +245,7 @@
           return instancesMainDicomTagsByLevel_;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
--- a/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -341,7 +341,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
     else
@@ -466,7 +466,7 @@
   {
     if (sequenceDepth_ == 0)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     sequenceDepth_ --;
@@ -562,7 +562,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       else
--- a/OrthancFramework/Sources/DicomFormat/DicomValue.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomValue.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -292,11 +292,11 @@
 
       case Type_SequenceAsJson:
       {
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -323,7 +323,7 @@
     }
     else if (type == "Sequence")
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
     else
     {
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -61,7 +61,7 @@
       // Add an empty sequence
       if (!dataset.insertEmptyElement(tag).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
     else
@@ -75,7 +75,7 @@
              !item->putAndInsertUint16(DCM_FailureReason, failureReasons[i]).good()) ||
             !dataset.insertSequenceItem(tag, item.release()).good())
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     }
@@ -737,7 +737,7 @@
       DcmDataset dataset;
       if (!dataset.putAndInsertString(DCM_TransactionUID, transactionUid.c_str()).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       {
@@ -916,7 +916,7 @@
       DcmDataset dataset;
       if (!dataset.putAndInsertString(DCM_TransactionUID, transactionUid.c_str()).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       {
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -289,7 +289,7 @@
   {
     if (target.type() != Json::objectValue)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
--- a/OrthancFramework/Sources/DicomNetworking/DicomConnectionInfo.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomConnectionInfo.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -42,7 +42,7 @@
   {
     if (target.type() != Json::objectValue)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
--- a/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -150,7 +150,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     switch (level)
@@ -569,7 +569,7 @@
         sopClass = UID_GETStudyRootQueryRetrieveInformationModel;
         break;
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     // Figure out which of the accepted presentation contexts should be used
@@ -947,7 +947,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     MoveInternal(targetAet, level, move, messageId);
@@ -960,7 +960,7 @@
   {
     if (!moveQuery.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     const std::string tmp = moveQuery.GetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL).GetContent();
--- a/OrthancFramework/Sources/DicomNetworking/DicomStoreUserConnection.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomStoreUserConnection.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -234,7 +234,7 @@
   {
     if (dicom.getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     OFString a, b;
@@ -315,7 +315,7 @@
           mandatory->second.find(transferSyntax) == mandatory->second.end())
       {
         // Should never fail because of (*)
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (!ProposeStorageClass(sopClassUid, mandatory->second, hasPreferred, preferred))
@@ -425,7 +425,7 @@
 
     if (dicom.getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     // Finally conduct transmission of data
@@ -483,7 +483,7 @@
 
     if (dicom.get() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     Store(sopClassUid, sopInstanceUid, *dicom, hasMoveOriginator, moveOriginatorAET, moveOriginatorID);
@@ -641,7 +641,7 @@
         if (!FromDcmtkBridge::LookupOrthancTransferSyntax(transcodedSyntax, transcoded.GetParsed()) ||
             accepted.find(transcodedSyntax) == accepted.end())
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
--- a/OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1103,7 +1103,7 @@
       if (msg->CommandField != DIMSE_N_ACTION_RQ /* value == 304 == 0x0130 */ ||
           !server_.HasStorageCommitmentRequestHandlerFactory())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
 
@@ -1239,7 +1239,7 @@
       if (msg->CommandField != DIMSE_N_EVENT_REPORT_RQ /* value == 256 == 0x0100 */ ||
           !server_.HasStorageCommitmentRequestHandlerFactory())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
 
--- a/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -144,7 +144,7 @@
 
       if (processedCount > handler.GetSubOperationCount())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       response.NumberOfRemainingSubOperations = (handler.GetSubOperationCount() - processedCount);
--- a/OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -58,7 +58,7 @@
     if (that_.connection_.get() == NULL)
     {
       // The allocation should have been done by "that_.Open()" in the constructor
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
--- a/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -118,7 +118,7 @@
 
     if (dicom.getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     DicomTransferSyntax syntax;
@@ -410,7 +410,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }  
     }
     else
--- a/OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -187,7 +187,7 @@
 
       if (!target.putAndInsertString(key, s.c_str()).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
                             
@@ -442,7 +442,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (!found)
@@ -480,7 +480,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       CopyStringType1C(*record, dataset, encoding, hasCodeExtensions, DCM_SpecificCharacterSet);
@@ -498,7 +498,7 @@
                                EET_UndefinedLength /*encodingType*/, 
                                EGL_withoutGL /*groupLength*/).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       file_.Read(s);
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -515,7 +515,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     std::string original;
@@ -938,7 +938,7 @@
         if (vr != ValueRepresentation_LongString &&
             vr != ValueRepresentation_NotSupported /* if no dictionary loaded */)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       else if (*it == DICOM_TAG_PATIENT_NAME)
@@ -946,13 +946,13 @@
         if (vr != ValueRepresentation_PersonName &&
             vr != ValueRepresentation_NotSupported /* if no dictionary loaded */)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       else if (vr != ValueRepresentation_UniqueIdentifier &&
                vr != ValueRepresentation_NotSupported /* for older versions of DCMTK */)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }        
   }
@@ -1231,7 +1231,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
@@ -1562,7 +1562,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       assert(tmp2 != NULL);
--- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -248,7 +248,7 @@
     std::string t = FormatTag(tag);
     if (node.isMember(t))
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -286,7 +286,7 @@
                !(*node) [t].isMember(KEY_VALUE) ||
                (*node)  [t][KEY_VALUE].type() != Json::arrayValue)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else
       {
@@ -302,7 +302,7 @@
         }
         else
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
           
         node = &(*node) [t][KEY_VALUE][Json::ArrayIndex(parentIndexes[i])];
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1303,7 +1303,7 @@
       DcmElement* element = item.getElement(i);
       if (element == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       DicomTag tag(FromDcmtkBridge::Convert(element->getTag()));
@@ -1936,7 +1936,7 @@
     E_TransferSyntax xfer;
     if (!LookupDcmtkTransferSyntax(xfer, syntax))
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -2185,7 +2185,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -2203,7 +2203,7 @@
 
         case EVR_OB:  // other byte
         case EVR_OW:  // other word
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     
         case EVR_UN:  // unknown value representation
           throw OrthancException(ErrorCode_ParameterOutOfRange);
@@ -2562,7 +2562,7 @@
   {
     if (!target.putAndInsertString(tag, value.c_str()).good())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -2617,7 +2617,7 @@
         if (!result->insert(tmp, false, false).good())
         {
           delete tmp;
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     }
@@ -2846,7 +2846,7 @@
         DcmElement* element = dataset.getElement(i);
         if (element == NULL)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
@@ -3035,7 +3035,7 @@
         }
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -3503,7 +3503,7 @@
   {
     if (dicom.getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -3666,7 +3666,7 @@
         {
           if (!item.insertEmptyElement(key, OFTrue /* replace old value */).good())
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
         }
       }
--- a/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -72,7 +72,7 @@
   {
     if (dicom.getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     DcmDataset& dataset = *dicom.getDataset();
@@ -99,7 +99,7 @@
     
     if (parsed.getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     std::string targetSopInstanceUid = GetSopInstanceUid(parsed);
@@ -108,7 +108,7 @@
     {
       if (!allowNewSopInstanceUid && (targetSopInstanceUid != sourceSopInstanceUid))
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
     else
@@ -131,7 +131,7 @@
       // No transcoding should have happened
       if (targetSopInstanceUid != sourceSopInstanceUid)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
         
@@ -147,14 +147,14 @@
         case TranscodingType_Lossy:
           if (targetSopInstanceUid == sourceSopInstanceUid)
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
           break;
 
         case TranscodingType_Lossless:
           if (targetSopInstanceUid != sourceSopInstanceUid)
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
           break;
 
@@ -176,7 +176,7 @@
     {
       if (isExternalBuffer_)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else
       {
@@ -216,7 +216,7 @@
     }
     else if (parsed_->getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -256,7 +256,7 @@
     }
     else if (parsed->getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else if (parsed_.get() != NULL)
     {
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -75,7 +75,7 @@
       if (!item->getUint8Array(content).good() ||
           content == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       table.resize(length / 4);
@@ -115,7 +115,7 @@
         DcmObject* fragment = pixelSequence_->nextInContainer(NULL);  // Skip the offset table
         if (fragment == NULL)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         for (unsigned int i = 0; i < countFrames; i++)
@@ -145,13 +145,13 @@
       DcmObject* fragment = pixelSequence_->nextInContainer(NULL);
       if (fragment == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       fragment = pixelSequence_->nextInContainer(fragment); // Skip the offset table
       if (fragment == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       uint32_t offset = 0;
@@ -214,7 +214,7 @@
         if (!fragment->getUint8Array(content).good() ||
             content == NULL)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         assert(offset + fragment->getLength() <= frame.size());
@@ -247,7 +247,7 @@
       if (!fragment->getUint8Array(content).good() ||
           content == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       return content;
     }
@@ -341,7 +341,7 @@
 
     virtual uint8_t* GetRawFrameBuffer(unsigned int index) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   };
 
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -358,7 +358,7 @@
                    << (info.IsPlanar() ? ", planar, " : ", non-planar, ")
                    << EnumerationToString(info.GetPhotometricInterpretation())
                    << " photometric interpretation";
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     return new Image(format, info.GetWidth(), info.GetHeight(), false);
@@ -424,7 +424,7 @@
     if (pixelData == NULL &&
         !dataset.findAndGetUint8Array(DCM_PixelData, pixelData, &pixelLength).good())
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     if (info.IsPlanar() ||
@@ -486,13 +486,13 @@
 
           if (!dataset.findAndGetUint16(DCM_BitsAllocated, bitsAllocated).good())
           {
-            throw OrthancException(ErrorCode_NotImplemented);  
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);  
           }
 
           if (!dataset.findAndGetElement(DCM_PixelData, elem).good() ||
               elem == NULL)
           {
-            throw OrthancException(ErrorCode_NotImplemented);  
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);  
           }
 
           // In implicit VR files, pixelLength is expressed in words (OW) although pixels can actually be 8 bits
@@ -570,7 +570,7 @@
         break;
     }
 
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }                                          
 
 
@@ -589,7 +589,7 @@
     if (source.GetWidth() != target->GetWidth() ||
         source.GetHeight() != target->GetHeight())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     
@@ -664,7 +664,7 @@
             }
 
             default:
-              throw OrthancException(ErrorCode_InternalError);
+              THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
             
           ImageProcessing::ShiftRight(*target, info.GetShift());
@@ -701,7 +701,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -726,7 +726,7 @@
     if (source.GetFormat() != PixelFormat_RGB24 ||
         3 * width != source.GetPitch())
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     std::unique_ptr<ImageAccessor> target(new Image(PixelFormat_RGB24, width, height, false));
@@ -926,7 +926,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     
       std::unique_ptr<ImageAccessor> result(ApplyCodec(*decoder, parameters, representationParameter, dataset, frame));
@@ -990,7 +990,7 @@
           break;
           
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       std::unique_ptr<ImageAccessor> result(ApplyCodec(*decoder, parameters, representationParameter, dataset, frame));
@@ -1150,7 +1150,7 @@
       }
       
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1199,7 +1199,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
--- a/OrthancFramework/Sources/DicomParsing/Internals/SopInstanceUidFixer.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/SopInstanceUidFixer.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -64,7 +64,7 @@
             !target.getDataset()->putAndInsertString(
               DCM_SOPInstanceUID, sopInstanceUid_.c_str(), OFTrue /* replace */).good())
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     }
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -57,7 +57,7 @@
     if (found == offsetToIndex_.end())
     {
       // Error in the algorithm that computes the offsets
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -96,7 +96,7 @@
       if (item == NULL)
       {
         Clear();
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       Uint32 next, lower;
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -392,7 +392,7 @@
     }
     catch (std::bad_cast&)
     {
-      throw OrthancException(ErrorCode_InternalError); // This should never happen / but I don't know why this std::bad_cast has been introduced (probably a std::bad_cast from DCMTK)
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError); // This should never happen / but I don't know why this std::bad_cast has been introduced (probably a std::bad_cast from DCMTK)
     }
 
     return false;
@@ -556,7 +556,7 @@
     {
       // This field already exists
       delete element;
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1306,7 +1306,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1321,7 +1321,7 @@
         accessor.GetFormat() != PixelFormat_RGBA32 &&
         accessor.GetFormat() != PixelFormat_RGBA64)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     InvalidateCache();
@@ -1406,7 +1406,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     assert(bytesPerPixel != 0);
@@ -1477,7 +1477,7 @@
           }
           
           default:
-            throw OrthancException(ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
       }
     }
@@ -1494,7 +1494,7 @@
 
     if (!GetDcmtkObject().getDataset()->insert(pixels.release(), false, false).good())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }    
   }
 
@@ -1511,7 +1511,7 @@
 
     if (!GetDcmtkObject().getDataset()->insert(pixels.release(), false, false).good())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1697,7 +1697,7 @@
 
     if (dcmDataset == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (!this->HasTag(DICOM_TAG_PIXEL_DATA) &&
@@ -1815,7 +1815,7 @@
   {
     if (GetDcmtkObjectConst().getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -1847,7 +1847,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (!ok)
@@ -1877,7 +1877,7 @@
                    << (info.IsPlanar() ? ", planar, " : ", non-planar, ")
                    << EnumerationToString(info.GetPhotometricInterpretation())
                    << " photometric interpretation";
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     std::unique_ptr<ImageAccessor> img(new ImageAccessor());
@@ -2264,14 +2264,14 @@
         case ValueRepresentation_OtherByte:
           if (!dataset.putAndInsertUint8Array(DCM_PixelData, NULL, 0).good())
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
           break;
 
         case ValueRepresentation_OtherWord:
           if (!dataset.putAndInsertUint16Array(DCM_PixelData, NULL, 0).good())
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
           break;
 
@@ -2292,7 +2292,7 @@
       DcmElement* element = dataset.getElement(i - 1);
       if (element == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (element->getTag().getGroup() > DCM_PixelData.getGroup() ||
@@ -2363,7 +2363,7 @@
           !pixelSequence->storeCompressedFrame(offsetList, raw, content.size(), 0 /* unlimited fragment size */).good() ||
           !offsetTable->createOffsetTable(offsetList).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       std::unique_ptr<DcmPixelData> pixelData(new DcmPixelData(DCM_PixelData));
@@ -2372,7 +2372,7 @@
       if (!GetDcmtkObject().getDataset()->insert(pixelData.release(), true, false).good() ||
           !GetDcmtkObject().getDataset()->chooseRepresentation(EXS_JPEGProcess1, NULL).good())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 #else
       throw OrthancException(ErrorCode_InternalError, "Orthanc was compiled without support for JPEG");
--- a/OrthancFramework/Sources/Enumerations.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Enumerations.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -2512,7 +2512,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
--- a/OrthancFramework/Sources/FileStorage/MemoryStorageArea.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/FileStorage/MemoryStorageArea.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -63,7 +63,7 @@
     }
     else if (content_.find(uuid) != content_.end())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -107,7 +107,7 @@
       }
       else if (found->second == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else if (end > found->second->size())
       {
@@ -140,7 +140,7 @@
     }
     else if (found->second == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
--- a/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -207,7 +207,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -288,7 +288,7 @@
 
       default:
       {
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
 
--- a/OrthancFramework/Sources/HttpClient.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/HttpClient.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -229,7 +229,7 @@
 
       if (curlBufferSize == 0)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (pendingPos_ + curlBufferSize <= pending_.size())
@@ -999,7 +999,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (method_ == HttpMethod_Post ||
--- a/OrthancFramework/Sources/HttpServer/HttpOutput.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpOutput.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -192,7 +192,7 @@
 
     if (state_ == State_WritingMultipart)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (state_ == State_WritingHeader)
@@ -307,7 +307,7 @@
         return;  // Ignore
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }      
   }
 
@@ -528,7 +528,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     LOG(TRACE) << "Compressing a HTTP answer using " << encoding;
@@ -624,7 +624,7 @@
      **/
     if (boundary.size() != 36 + 1 + 36)  // one UUID contains 36 characters
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     boundary.resize(70);
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -470,7 +470,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       else
@@ -1031,7 +1031,7 @@
               }
               else
               {
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
               }
             }
             else if (!path.empty() &&
@@ -1052,7 +1052,7 @@
                 Toolbox::SplitUriComponents(p, uri);
                 if (p.empty())
                 {
-                  throw OrthancException(ErrorCode_InternalError);
+                  THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
                 }
 
                 p.resize(p.size() - 1);
@@ -1060,7 +1060,7 @@
               }
               else
               {
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
               }
             }
             else
@@ -1220,7 +1220,7 @@
           }
           else
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
         }
       }
@@ -1550,7 +1550,7 @@
         {
           if (stream.get() == NULL)
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           postStatus = ReadBodyToStream(*stream, connection, headers, server.HasMaxBodySize(), server.GetMaxBodySize());
@@ -1588,7 +1588,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -2333,7 +2333,7 @@
   {
     if (handler_ == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     return *handler_;
--- a/OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -39,7 +39,7 @@
   {
     if (source_.SetupHttpCompression(false, false) != HttpCompression_None)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     uint64_t size = source_.GetContentLength();
@@ -60,7 +60,7 @@
 
     if (offset != size)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -132,7 +132,7 @@
         return SetupZlibCompression(deflateAllowed);
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -163,7 +163,7 @@
       uint64_t length = source_.GetContentLength();
       if (length < bytesToSkip_)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       return length - bytesToSkip_;
--- a/OrthancFramework/Sources/HttpServer/WebDavStorage.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/WebDavStorage.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -281,7 +281,7 @@
     {
       if (path.size() == 0)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else if (path.size() == 1)
       {
--- a/OrthancFramework/Sources/Images/Font.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/Font.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -252,7 +252,7 @@
         }
 
         default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
 
@@ -270,7 +270,7 @@
         target.GetFormat() != PixelFormat_RGBA32 &&
         target.GetFormat() != PixelFormat_BGRA32)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     int a = x;
--- a/OrthancFramework/Sources/Images/ImageAccessor.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageAccessor.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -317,7 +317,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }   
 
     buffer.Flatten(target);
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -624,7 +624,7 @@
             ApplyWindowingInternal<uint16_t, float>(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert);
             break;
           default:
-            throw OrthancException(ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
       };break;
       case PixelFormat_Grayscale8:
@@ -638,7 +638,7 @@
             ApplyWindowingInternal<uint16_t, uint8_t>(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert);
             break;
           default:
-            throw OrthancException(ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
       };break;
       case PixelFormat_Grayscale16:
@@ -652,11 +652,11 @@
             ApplyWindowingInternal<uint16_t, uint16_t>(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert);
             break;
           default:
-            throw OrthancException(ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
       };break;
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1054,7 +1054,7 @@
       return;
     }
 
-    throw OrthancException(ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
   }
 
 
@@ -1099,7 +1099,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1149,7 +1149,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     const unsigned int width = image.GetWidth();
@@ -1186,7 +1186,7 @@
 
     if (alpha.GetFormat() != PixelFormat_Grayscale8)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     switch (image.GetFormat())
@@ -1204,7 +1204,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     const unsigned int width = image.GetWidth();
@@ -1254,7 +1254,7 @@
         break;
       }
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1283,7 +1283,7 @@
         break;
       }
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1330,7 +1330,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1359,7 +1359,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1383,7 +1383,7 @@
         return;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1428,7 +1428,7 @@
         return;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1502,7 +1502,7 @@
         return;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1575,11 +1575,11 @@
             return;
 
           default:
-            throw OrthancException(ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
         
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1653,7 +1653,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
   }
@@ -1665,7 +1665,7 @@
       case PixelFormat_Grayscale8:
         return Invert(image, 255);
       default:
-        throw OrthancException(ErrorCode_NotImplemented); // you should use the Invert(image, maxValue) overload
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented); // you should use the Invert(image, maxValue) overload
     }
   }
 
@@ -1840,7 +1840,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1896,7 +1896,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -2298,7 +2298,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -2423,7 +2423,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -2473,7 +2473,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -2513,7 +2513,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -2805,7 +2805,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -3036,7 +3036,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }          
   }
 
@@ -3110,7 +3110,7 @@
         return;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -3139,7 +3139,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -3180,7 +3180,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 }
--- a/OrthancFramework/Sources/Images/JpegReader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/JpegReader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -63,7 +63,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     uint64_t pitch = static_cast<uint64_t>(cinfo.output_width) * cinfo.output_components;
--- a/OrthancFramework/Sources/Images/JpegWriter.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/JpegWriter.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -83,7 +83,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     jpeg_set_defaults(&cinfo);
--- a/OrthancFramework/Sources/Images/NumpyWriter.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/NumpyWriter.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -65,7 +65,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     unsigned int channels;
@@ -98,7 +98,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     std::string depthString;
--- a/OrthancFramework/Sources/Images/PamReader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/PamReader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -69,7 +69,7 @@
           return;
 
         default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
     else if (tupleType == "RGB" &&
@@ -88,12 +88,12 @@
           return;
 
         default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -256,7 +256,7 @@
     if (bytesPerChannel != 1 &&
         bytesPerChannel != 2)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     if (Toolbox::DetectEndianness() == Endianness_Little &&
--- a/OrthancFramework/Sources/Images/PamWriter.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/PamWriter.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -73,7 +73,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -100,7 +100,7 @@
     if (bytesPerChannel != 1 &&
         bytesPerChannel != 2)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     size_t targetPitch = static_cast<size_t>(channelCount) * bytesPerChannel * width;
--- a/OrthancFramework/Sources/Images/PngReader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/PngReader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -197,7 +197,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     uint64_t totalSize = pitch * height;
--- a/OrthancFramework/Sources/Images/PngWriter.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Images/PngWriter.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -173,7 +173,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
 
@@ -277,7 +277,7 @@
     if (setjmp(png_jmpbuf(context.GetObject())))
     {
       // Error during writing PNG
-      throw OrthancException(ErrorCode_InternalError);      
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);      
     }
 
     png_set_write_fn(context.GetObject(), &chunks, MemoryCallback, NULL);
--- a/OrthancFramework/Sources/JobsEngine/JobsEngine.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobsEngine.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -102,7 +102,7 @@
         return true;
             
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -176,7 +176,7 @@
   {
     if (registry_.get() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     return *registry_;
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -495,7 +495,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
@@ -550,7 +550,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     LOG(INFO) << "Job has completed with " << tmp << ": " << job.GetId();
@@ -952,7 +952,7 @@
           }
           else
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
         }
         else if (state == JobState_Success)
@@ -1087,7 +1087,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       CheckInvariants();
@@ -1142,7 +1142,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       // WARNING: The following call might make "handler" invalid if
@@ -1677,7 +1677,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
--- a/OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -97,7 +97,7 @@
     {
       if (other.index_ <= index_)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (!unserializing &&
--- a/OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.h	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.h	Tue Jun 02 12:44:19 2026 +0200
@@ -143,7 +143,7 @@
 
     virtual void SetUserData(const Json::Value& userData) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     virtual bool GetUserData(Json::Value& userData) const ORTHANC_OVERRIDE
--- a/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -174,7 +174,7 @@
   {
     if (!started_)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (commands_.empty() &&
--- a/OrthancFramework/Sources/Logging.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Logging.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -95,7 +95,7 @@
       }
       else 
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
--- a/OrthancFramework/Sources/MallocMemoryBuffer.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/MallocMemoryBuffer.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -61,7 +61,7 @@
     {
       if (free_ == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
         
       free_(buffer_);
--- a/OrthancFramework/Sources/MetricsRegistry.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/MetricsRegistry.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -111,7 +111,7 @@
           case MetricsUpdatePolicy_MinOver1Minute:
             return 60;
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
 
--- a/OrthancFramework/Sources/MultiThreading/FutureState.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/MultiThreading/FutureState.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -50,7 +50,7 @@
                 if (state_ != State_Success &&
                     state_ != State_Failed)
                 {
-                  throw OrthancException(ErrorCode_InternalError);  // Should never happen
+                  THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Should never happen
                 }
               }
             }
@@ -85,7 +85,7 @@
             }
 
           default:
-            throw OrthancException(ErrorCode_InternalError);  // Should never happen
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Should never happen
         }
       }
     }
@@ -134,7 +134,7 @@
             throw OrthancException(ErrorCode_BadSequenceOfCalls);
 
           default:
-            throw OrthancException(ErrorCode_InternalError);  // Should never happen
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Should never happen
         }
       }
     }
@@ -163,7 +163,7 @@
           throw OrthancException(ErrorCode_BadSequenceOfCalls);
 
         default:
-          throw OrthancException(ErrorCode_InternalError);  // Should never happen
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Should never happen
       }
     }
   }
--- a/OrthancFramework/Sources/MultiThreading/ThreadPool.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/MultiThreading/ThreadPool.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -165,7 +165,7 @@
         default:
           if (throws)
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
           else
           {
--- a/OrthancFramework/Sources/RestApi/RestApi.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/RestApi/RestApi.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -403,7 +403,7 @@
                paths_[path].type() != Json::objectValue) ||
               paths_[path].isMember(method))
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           paths_[path][method] = v;
@@ -474,7 +474,7 @@
             case HttpMethod_Get:
               if (hasGet_)
               {
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
               }
               
               hasGet_ = true;
@@ -485,7 +485,7 @@
             case HttpMethod_Post:
               if (hasPost_)
               {
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
               }
               
               hasPost_ = true;
@@ -496,7 +496,7 @@
             case HttpMethod_Delete:
               if (hasDelete_)
               {
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
               }
               
               hasDelete_ = true;
@@ -507,7 +507,7 @@
             case HttpMethod_Put:
               if (hasPut_)
               {
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
               }
               
               hasPut_ = true;
@@ -654,7 +654,7 @@
               break;              
 
             default:
-              throw OrthancException(ErrorCode_InternalError);
+              THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           if (verb.empty())
--- a/OrthancFramework/Sources/SharedLibrary.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/SharedLibrary.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -131,7 +131,7 @@
   {
     if (!handle_)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
 #if defined(_WIN32)
--- a/OrthancFramework/Sources/Toolbox.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/Sources/Toolbox.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1317,7 +1317,7 @@
         return Endianness_Little;
         
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1530,7 +1530,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -1991,7 +1991,7 @@
       if (Toolbox::DetectEndianness() != Endianness_Little)
       {
         // TODO - The data table must be swapped (uint16_t)
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
 #endif
@@ -2315,7 +2315,7 @@
           }
           else
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           Dictionary::const_iterator found = dictionary_.find(key);
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1371,7 +1371,7 @@
       break;
 
     default:
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
 
   ParsedDicomFile f(false);
@@ -1566,7 +1566,7 @@
 
     if (components.size() != 2)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     int a = boost::lexical_cast<int>(components[0]);
@@ -1575,7 +1575,7 @@
         b < 0 || b > 15 ||
         (a == 0 && b == 0))
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     result[i] = static_cast<char>(a * 16 + b);
@@ -1988,7 +1988,7 @@
   DcmTagKey v = ToDcmtkBridge::Convert(value);
   if (!element->putTagVal(v).good())
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
 
   dicom.GetDcmtkObject().getDataset()->insert(element.release());
@@ -2405,7 +2405,7 @@
   }
   else
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
 }
 
@@ -2922,7 +2922,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }        
     }
 
@@ -2960,7 +2960,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }        
     }
 
@@ -2983,7 +2983,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -3009,7 +3009,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -3033,7 +3033,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -3066,7 +3066,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -3422,7 +3422,7 @@
       case 1: bitsAllocated = 8;   break;
       case 2: bitsAllocated = 16;  break;
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
       
     for (Syntaxes::const_iterator it = compressedSyntaxes.begin(); it != compressedSyntaxes.end(); ++it)
@@ -3489,7 +3489,7 @@
       case 0: bitsAllocated = 1;   break;
       case 1: bitsAllocated = 8;   break;
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     ASSERT_EQ(ValueRepresentation_OtherByte, DicomImageInformation::GuessPixelDataValueRepresentation(DicomTransferSyntax_LittleEndianExplicit, bitsAllocated));
--- a/OrthancFramework/UnitTestsSources/JobsTests.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/JobsTests.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -142,7 +142,7 @@
     
     virtual void SetUserData(const Json::Value& userData) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     virtual bool GetUserData(Json::Value& userData) const ORTHANC_OVERRIDE
@@ -173,7 +173,7 @@
       {
         if (trailingStepDone_)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
@@ -183,7 +183,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -307,7 +307,7 @@
     q.Enqueue(new DynamicInteger(10, s));
     q.Enqueue(new DynamicInteger(20, s));  
     ASSERT_EQ(2, s.size());
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
   catch (OrthancException&)
   {
@@ -407,7 +407,7 @@
     q.Enqueue(o10, 0);
     q.Enqueue(o20, 0);
     ASSERT_EQ(2, s.size());
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
   catch (OrthancException&)
   {
--- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1315,7 +1315,7 @@
       {
         if (b[i] != ('0' + i % 7))
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -232,7 +232,7 @@
     {
       if (that_.activeTransaction_ != NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       
       that_.activeTransaction_ = this;
@@ -574,7 +574,7 @@
     {
       if (!labels.empty())
       {
-        throw OrthancException(ErrorCode_InternalError);  // "HasLabelsSupport()" has returned "false"
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // "HasLabelsSupport()" has returned "false"
       }
       
       if (that_.extensions_.lookupResources == NULL)
@@ -1428,27 +1428,27 @@
     virtual void AddLabel(int64_t resource,
                           const std::string& label) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
 
     virtual void RemoveLabel(int64_t resource,
                              const std::string& label) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
 
     virtual void ListLabels(std::set<std::string>& target,
                             int64_t resource) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
     
 
     virtual void ListAllLabels(std::set<std::string>& target) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void StoreKeyValue(const std::string& storeId,
@@ -1456,20 +1456,20 @@
                                const void* value,
                                size_t valueSize) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void DeleteKeyValue(const std::string& storeId,
                                 const std::string& key) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual bool GetKeyValue(std::string& value,
                              const std::string& storeId,
                              const std::string& key) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void ListKeysValues(std::list<std::string>& keys,
@@ -1479,26 +1479,26 @@
                                 const std::string& from,
                                 uint64_t limit) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void EnqueueValue(const std::string& queueId,
                               const void* value,
                               size_t valueSize) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual bool DequeueValue(std::string& value,
                               const std::string& queueId,
                               QueueOrigin origin) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual uint64_t GetQueueSize(const std::string& queueId) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual bool ReserveQueueValue(std::string& value,
@@ -1507,26 +1507,26 @@
                                    QueueOrigin origin,
                                    uint32_t releaseTimeout) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
       
     virtual void AcknowledgeQueueValue(const std::string& queueId,
                                        uint64_t valueId) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void GetAttachmentCustomData(std::string& customData,
                                          const std::string& attachmentUuid) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);  // Not supported
     }
 
     virtual void SetAttachmentCustomData(const std::string& attachmentUuid,
                                          const void* customData,
                                          size_t customDataSize) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);  // Not supported
     }
   };
 
@@ -1753,6 +1753,6 @@
 
   uint64_t OrthancPluginDatabase::MeasureLatency()
   {
-    throw OrthancException(ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
   }
 }
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -807,7 +807,7 @@
     {
       if (!labels.empty())
       {
-        throw OrthancException(ErrorCode_InternalError);  // "HasLabelsSupport()" has returned "false"
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // "HasLabelsSupport()" has returned "false"
       }
       
       std::vector<OrthancPluginDatabaseConstraint> constraints;
@@ -1040,27 +1040,27 @@
     virtual void AddLabel(int64_t resource,
                           const std::string& label) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
 
     virtual void RemoveLabel(int64_t resource,
                              const std::string& label) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
 
     virtual void ListLabels(std::set<std::string>& target,
                             int64_t resource) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
     
 
     virtual void ListAllLabels(std::set<std::string>& target) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void StoreKeyValue(const std::string& storeId,
@@ -1068,20 +1068,20 @@
                                const void* value,
                                size_t valueSize) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void DeleteKeyValue(const std::string& storeId,
                                 const std::string& key) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual bool GetKeyValue(std::string& value,
                              const std::string& storeId,
                              const std::string& key) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void ListKeysValues(std::list<std::string>& keys,
@@ -1091,26 +1091,26 @@
                                 const std::string& from,
                                 uint64_t limit) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void EnqueueValue(const std::string& queueId,
                               const void* value,
                               size_t valueSize) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual bool DequeueValue(std::string& value,
                               const std::string& queueId,
                               QueueOrigin origin) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual uint64_t GetQueueSize(const std::string& queueId) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual bool ReserveQueueValue(std::string& value,
@@ -1119,26 +1119,26 @@
                                    QueueOrigin origin,
                                    uint32_t releaseTimeout) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
       
     virtual void AcknowledgeQueueValue(const std::string& queueId,
                                        uint64_t valueId) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_InternalError);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Not supported
     }
 
     virtual void GetAttachmentCustomData(std::string& customData,
                                          const std::string& attachmentUuid) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);  // Not supported
     }
 
     virtual void SetAttachmentCustomData(const std::string& attachmentUuid,
                                          const void* customData,
                                          size_t customDataSize) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);  // Not supported
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);  // Not supported
     }
   };
 
@@ -1296,7 +1296,7 @@
         return new Transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadWrite);
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1337,7 +1337,7 @@
 
   uint64_t OrthancPluginDatabaseV3::MeasureLatency()
   {
-    throw OrthancException(ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
   }
 
 }
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -491,7 +491,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
     
@@ -1045,7 +1045,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1065,7 +1065,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1304,7 +1304,7 @@
       if (!database_.GetDatabaseCapabilities().HasLabelsSupport() &&
           !labels.empty())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       DatabasePluginMessages::TransactionRequest request;
@@ -1507,7 +1507,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1526,7 +1526,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1886,7 +1886,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1904,7 +1904,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1934,7 +1934,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1965,7 +1965,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1991,7 +1991,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -2015,7 +2015,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         DatabasePluginMessages::TransactionResponse response;
@@ -2034,7 +2034,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -2053,7 +2053,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -2080,7 +2080,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         DatabasePluginMessages::TransactionResponse response;
@@ -2100,7 +2100,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
       
@@ -2119,7 +2119,7 @@
       else
       {
         // This method shouldn't have been called
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1027,7 +1027,7 @@
             return new PluginStorageAreaV3(callbacks3_, errorDictionary_);
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     };
@@ -1451,7 +1451,7 @@
               break;
 
             default:
-              throw OrthancException(ErrorCode_InternalError);
+              THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
         }
         else
@@ -1616,7 +1616,7 @@
           }
           else
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           if (error == OrthancPluginErrorCode_Success)
@@ -1687,7 +1687,7 @@
         }
         else
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         if (error != OrthancPluginErrorCode_Success)
@@ -1709,7 +1709,7 @@
         }
         else
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     };
@@ -1950,7 +1950,7 @@
         }
         else
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         Reset();
@@ -2054,7 +2054,7 @@
         }
         else
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         if (error != OrthancPluginErrorCode_Success)
@@ -2104,7 +2104,7 @@
         }
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   };
@@ -2232,7 +2232,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -2283,7 +2283,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (driver == NULL)
@@ -2306,7 +2306,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   };
@@ -2649,7 +2649,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         converted_.groups = matcher.GetGroups();
@@ -3024,7 +3024,7 @@
         SignalChangeInternal(OrthancPluginChangeType_JobFailure, OrthancPluginResourceType_None, event.GetJobId().c_str());
         break;
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -3728,7 +3728,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     std::vector<std::string> result;
@@ -3896,7 +3896,7 @@
         return;
         
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -4089,7 +4089,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -4122,7 +4122,7 @@
         return;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
 
     }
   }
@@ -4657,7 +4657,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
@@ -4834,7 +4834,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     *(p.target) = ReturnImage(result);
@@ -5214,7 +5214,7 @@
 
     if (target.get() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -6416,7 +6416,7 @@
           }
           else
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
         }
         else
@@ -6556,7 +6556,7 @@
       }
 
       case _OrthancPluginService_DatabaseAnswer:
-        throw OrthancException(ErrorCode_InternalError);   // Implemented before locking (*)
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);   // Implemented before locking (*)
 
       case _OrthancPluginService_RegisterErrorCode:
       {
@@ -7089,7 +7089,7 @@
     if (method != HttpMethod_Post &&
         method != HttpMethod_Put)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     RestCallbackMatcher matcher(uri);
--- a/OrthancServer/Plugins/Engine/PluginsJob.h	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Plugins/Engine/PluginsJob.h	Tue Jun 02 12:44:19 2026 +0200
@@ -87,7 +87,7 @@
 
     virtual void SetUserData(const Json::Value& userData) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     virtual bool GetUserData(Json::Value& userData) const ORTHANC_OVERRIDE
--- a/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -125,7 +125,7 @@
           break;
           
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       candidates.Intersect(matches);
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -71,7 +71,7 @@
       if (!IsResourceLevelAboveOrEqual(topLevel, bottomLevel) ||
           topLevel == bottomLevel)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       std::list<int64_t> currentResources;
--- a/OrthancServer/Sources/Database/Compatibility/ILookupResourceAndParent.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/ILookupResourceAndParent.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -50,7 +50,7 @@
         int64_t parentId;
         if (!database.LookupParent(parentId, id))
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         parentPublicId = database.GetPublicId(parentId);
--- a/OrthancServer/Sources/Database/Compatibility/SetOfResources.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/SetOfResources.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -111,7 +111,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
--- a/OrthancServer/Sources/Database/FindResponse.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/FindResponse.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -136,7 +136,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
@@ -511,7 +511,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
     else
@@ -522,7 +522,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
@@ -665,7 +665,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
--- a/OrthancServer/Sources/Database/ResourcesContent.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/ResourcesContent.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -93,7 +93,7 @@
       // This would require to handle the incrementation of revision
       // numbers in the database backend => only allow setting
       // metadata on new resources
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
@@ -129,7 +129,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     StoreMainDicomTagsInternal(*this, resource, tags);  // saves only leaf tags, not sequences
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -295,7 +295,7 @@
         }
       
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       assert(statement.get() != NULL);
@@ -610,7 +610,7 @@
           }
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
 
@@ -1293,7 +1293,7 @@
           }; break;
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
       }
     }
@@ -1854,7 +1854,7 @@
         }
         else if (!s.ColumnBlobAsString(0, &customData))
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     }
@@ -2325,7 +2325,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       // "reservedUntil <= ?" indicates that the reservation has expired
@@ -2347,7 +2347,7 @@
         int64_t id = s.ColumnInt64(0);
         if (id < 0)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         valueId = static_cast<uint64_t>(id);
@@ -2425,7 +2425,7 @@
         }
         else if (db_.GetLastChangeCount() > 1)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         return true;
@@ -2457,7 +2457,7 @@
       }
       else if (db_.GetLastChangeCount() > 1)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   };
@@ -2663,7 +2663,7 @@
       if (that_.activeTransaction_ != NULL)
       {
         isNested_ = true;
-        // throw OrthancException(ErrorCode_InternalError);
+        // THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else
       {      
@@ -2688,7 +2688,7 @@
     {
       if (fileSizeDelta != 0)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   };
@@ -3002,7 +3002,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -3091,7 +3091,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h	Tue Jun 02 12:44:19 2026 +0200
@@ -97,7 +97,7 @@
 
     virtual uint64_t MeasureLatency() ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     virtual bool HasIntegratedFind() const ORTHANC_OVERRIDE
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -434,7 +434,7 @@
     if ((readOperations == NULL && writeOperations == NULL) ||
         (readOperations != NULL && writeOperations != NULL))
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (factory_.get() == NULL)
@@ -1192,7 +1192,7 @@
                 // don't count patients
                 break;
               default:
-                throw OrthancException(ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
             }
           }
 
@@ -1341,7 +1341,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       else
@@ -1638,7 +1638,7 @@
               break;
 
             default:
-              throw OrthancException(ErrorCode_InternalError);
+              THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           // If we have not reached the Patient level, find the parent of
@@ -2271,7 +2271,7 @@
             series == -1 ||
             instance == -1)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         if (limitToThisLevelDicomTags_)
@@ -2415,7 +2415,7 @@
         hasPatientToAvoid = transaction_.LookupResource(patientToAvoid, type, newPatientId);
         if (type != ResourceType_Patient)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
 
@@ -3782,7 +3782,7 @@
       else if (currentKey_ != keys_.end() ||
                currentValue_ != values_.end())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -3851,7 +3851,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);  // Should never happen
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);  // Should never happen
     }
   }
 
--- a/OrthancServer/Sources/Database/VoidDatabaseListener.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Database/VoidDatabaseListener.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -31,17 +31,17 @@
   void VoidDatabaseListener::SignalRemainingAncestor(ResourceType parentType,
                                                      const std::string& publicId)
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
       
   void VoidDatabaseListener::SignalAttachmentDeleted(const FileInfo& info)
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
 
   void VoidDatabaseListener::SignalResourceDeleted(ResourceType type,
                                                    const std::string& publicId)
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }      
 }
--- a/OrthancServer/Sources/DicomInstanceOrigin.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/DicomInstanceOrigin.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -67,7 +67,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
--- a/OrthancServer/Sources/ExportedResource.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ExportedResource.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -55,7 +55,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 }
--- a/OrthancServer/Sources/LuaScripting.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/LuaScripting.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -229,7 +229,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       {
@@ -279,7 +279,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       {
@@ -333,7 +333,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       {
@@ -387,7 +387,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       {
@@ -773,7 +773,7 @@
      
     if (operations.type() != Json::arrayValue)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     LuaJobManager::Lock lock(pimpl_->jobManager_, context_.GetJobsEngine());
@@ -786,13 +786,13 @@
       if (operations[i].type() != Json::objectValue ||
           !operations[i].isMember("Operation"))
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       const Json::Value& parameters = operations[i];
       if (!parameters.isMember("Resource"))
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       std::string operation = parameters["Operation"].asString();
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -338,7 +338,7 @@
         level != ResourceType_Series &&
         level != ResourceType_Instance)
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     DicomArray query(*filteredInput);
--- a/OrthancServer/Sources/OrthancGetRequestHandler.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancGetRequestHandler.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -86,7 +86,7 @@
     if (parsed.get() == NULL ||
         parsed->getDataset() == NULL)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     DcmDataset& dataset = *parsed->getDataset();
--- a/OrthancServer/Sources/OrthancHttpHandler.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancHttpHandler.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -42,7 +42,7 @@
     if (method != HttpMethod_Post &&
         method != HttpMethod_Put)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     for (Handlers::const_iterator it = handlers_.begin(); it != handlers_.end(); ++it) 
@@ -52,7 +52,7 @@
       {
         if (target.get() == NULL)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         return true;
@@ -106,7 +106,7 @@
     {
       if (orthancRestApi_ == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       return *orthancRestApi_;
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -859,7 +859,7 @@
         if (siblingInstances.empty())
 	{
 	  // Error: No instance (should never happen)
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         siblingInstanceId = siblingInstances.front();
@@ -907,7 +907,7 @@
         std::string tmp;
         if (!context.GetIndex().LookupParent(tmp, parent))
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         parent = tmp;
@@ -1039,7 +1039,7 @@
         {
           if (encapsulate)
           {
-            throw OrthancException(ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
           }
           else
           {
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -682,7 +682,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -744,7 +744,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
   }
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -314,7 +314,7 @@
                                                    bool deflateAllowed) ORTHANC_OVERRIDE
       {
         // This function is not called by HttpOutput::AnswerWithoutBuffering()
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       virtual bool HasContentFilename(std::string& filename) ORTHANC_OVERRIDE
@@ -330,7 +330,7 @@
 
       virtual uint64_t GetContentLength() ORTHANC_OVERRIDE
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       virtual bool ReadNextChunk() ORTHANC_OVERRIDE
@@ -378,7 +378,7 @@
       {
         if (done_)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
@@ -390,7 +390,7 @@
       {
         if (done_)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -984,7 +984,7 @@
                     << query.GetHandler().GetRemoteModality().GetApplicationEntityTitle();
       }; break;
       default:
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     job->SetQueryFormat(OrthancRestApi::GetDicomFormat(body, DicomToJsonFormat_Short));
@@ -1346,7 +1346,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     }
@@ -2498,7 +2498,7 @@
 
       if (sopClassUids.size() != sopInstanceUids.size())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       const std::string transactionUid = Toolbox::GenerateDicomPrivateUniqueIdentifier();
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -597,7 +597,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1013,7 +1013,7 @@
         {
           if (dicom == NULL)
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
 
           DicomMap tags;
@@ -1127,7 +1127,7 @@
       {
         if (dicom == NULL)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         
         PhotometricInterpretation photometric;
@@ -2991,7 +2991,7 @@
           (resourceType == ResourceType_Instance && module == DicomModule_Instance) ||
           (resourceType == ResourceType_Instance && module == DicomModule_Image)))
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     ServerContext& context = OrthancRestApi::GetContext(call);
@@ -3189,7 +3189,7 @@
           .AddAnswerType(MimeType_Json, "A JSON object with the `Count` of matching resources");
           break;
         default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
         
       return;
@@ -3603,7 +3603,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -913,7 +913,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }      
       
       call.GetDocumentation()
@@ -950,7 +950,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     if (ok)
@@ -1107,7 +1107,7 @@
       }
     }
 
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
   
 
--- a/OrthancServer/Sources/OrthancWebDav.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/OrthancWebDav.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -134,7 +134,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (hasUid &&
@@ -334,7 +334,7 @@
           count++;
         }
 
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -1034,7 +1034,7 @@
     {
       if (path.size() != 7)  // Format: "YYYY-MM"
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       else
       {
@@ -1288,7 +1288,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
   
@@ -1415,7 +1415,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       DicomIdentifiersVisitorV2 visitor(collection);
--- a/OrthancServer/Sources/ResourceFinder.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -124,7 +124,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -200,7 +200,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
       }
     }
   }
@@ -223,7 +223,7 @@
 
     if (resource.GetLevel() != request_.GetLevel())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     target = Json::objectValue;
@@ -251,7 +251,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -281,7 +281,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -333,7 +333,7 @@
           }
           else
           {
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
           }
         }
 
@@ -357,7 +357,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     std::string s;
@@ -703,7 +703,7 @@
       if (IsComputedTag(constraint.GetTag()) && constraint.GetTag() != DICOM_TAG_MODALITIES_IN_STUDY)
       {
         // Sanity check
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   }
@@ -1098,7 +1098,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (lookup_.get() != NULL)
@@ -1262,7 +1262,7 @@
       case FindStorageAccessMode_DatabaseOnly:
         return false;
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1344,7 +1344,7 @@
 
     if (answer.type() != Json::arrayValue)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else if (answer.size() > 1)
     {
--- a/OrthancServer/Sources/Search/DatabaseDicomTagConstraints.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Search/DatabaseDicomTagConstraints.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -121,7 +121,7 @@
         }
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       s += "\n";
--- a/OrthancServer/Sources/Search/DicomTagConstraint.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Search/DicomTagConstraint.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -218,7 +218,7 @@
     }
     else if (values_.size() != 1)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else
     {
@@ -304,7 +304,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -376,7 +376,7 @@
       }
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -400,7 +400,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     std::vector<std::string> values;
--- a/OrthancServer/Sources/Search/HierarchicalMatcher.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Search/HierarchicalMatcher.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -72,7 +72,7 @@
       DcmElement* element = dataset.getElement(i);
       if (element == NULL)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       DicomTag tag(FromDcmtkBridge::Convert(element->getTag()));
--- a/OrthancServer/Sources/Search/ISqlLookupFormatter.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/Search/ISqlLookupFormatter.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -54,7 +54,7 @@
         return "instances";
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }      
 
@@ -75,7 +75,7 @@
         return std::string(prefix) + "instances";
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }      
 
@@ -112,7 +112,7 @@
             break;
           
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         std::string parameter = formatter.GenerateParameter(constraint.GetSingleValue());
@@ -440,7 +440,7 @@
             break;
           
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         std::string parameter = formatter.GenerateParameter(constraint.GetSingleValue());
@@ -760,7 +760,7 @@
             FormatJoinForOrdering(orderingJoin, (*it)->GetMetadataType(), counter, request.GetLevel());
             break;
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         orderingJoins += orderingJoin;
         
--- a/OrthancServer/Sources/ServerContext.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -1745,7 +1745,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1757,7 +1757,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
   }
 
@@ -1810,7 +1810,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       
         Json::Value dicomAsJson;
@@ -1890,7 +1890,7 @@
         }
       }; break;
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
   }
--- a/OrthancServer/Sources/ServerIndex.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerIndex.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -541,7 +541,7 @@
           break;
         
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
     catch (OrthancException& e)
--- a/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -226,7 +226,7 @@
           break;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -244,7 +244,7 @@
 
       if (level > level_)
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       switch (level)
@@ -262,7 +262,7 @@
           return instance_;
 
         default:
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
   };
@@ -749,7 +749,7 @@
           }
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
 
@@ -1169,7 +1169,7 @@
         if (asynchronousTarget_.get() != NULL)
         {
           // It is up to this method to create the asynchronous target
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
--- a/OrthancServer/Sources/ServerJobs/CleaningInstancesJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/CleaningInstancesJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -69,7 +69,7 @@
     if (!HasTrailingStep())
     {
       // Should have been set by (*)
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (serialized.isMember(KEEP_SOURCE))
--- a/OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -80,7 +80,7 @@
       if (sopClassUids_.size() != sopInstanceUids_.size() ||
           sopClassUids_.size() > GetInstancesCount())
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
       
       if (sopClassUids_.size() == GetInstancesCount())
@@ -112,7 +112,7 @@
 
   bool DicomModalityStoreJob::HandleTrailingStep()
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
 
 
--- a/OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -376,7 +376,7 @@
     if (!HasTrailingStep())
     {
       // Should have been set by (*)
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     targetStudy_ = SerializationToolbox::ReadString(serialized, TARGET_STUDY);
--- a/OrthancServer/Sources/ServerJobs/Operations/ModifyInstanceOperation.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/ModifyInstanceOperation.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -67,7 +67,7 @@
     if (origin_ != RequestOrigin_Lua)
     {
       // TODO If issued from HTTP, "remoteIp" and "username" must be provided
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
   }
 
--- a/OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -133,7 +133,7 @@
 
   bool OrthancPeerStoreJob::HandleTrailingStep()
   {
-    throw OrthancException(ErrorCode_InternalError);
+    THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
   }
 
 
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -84,7 +84,7 @@
             break;
 
           default:
-            throw OrthancException(ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
 
         patientId_ = hasher.HashPatient();
@@ -274,7 +274,7 @@
             !modified->GetDcmtkObject().getDataset()->putAndInsertString(
               DCM_SOPInstanceUID, modifiedUid.c_str(), OFTrue /* replace */).good())
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
       else
--- a/OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -337,7 +337,7 @@
     if (!HasTrailingStep())
     {
       // Should have been set by (*)
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     Setup();
--- a/OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -221,7 +221,7 @@
 
     if (n <= 1)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     for (size_t i = 0; i < n; i++)
@@ -232,7 +232,7 @@
           (i >= 1 && i < n - 1 && type != CommandType_Lookup) ||
           (i == n - 1 && type != CommandType_Answer))
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
 
       if (type == CommandType_Lookup)
@@ -240,7 +240,7 @@
         const LookupCommand& lookup = dynamic_cast<const LookupCommand&>(GetCommand(i));
         if (lookup.GetIndex() != i - 1)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
       }
     }
@@ -264,7 +264,7 @@
 
     if (index >= sopClassUids_.size())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     else if (lookupHandler_.get() != NULL)
     {
@@ -336,7 +336,7 @@
 
     if (failureReasons.size() != sopClassUids_.size())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     DicomAssociationParameters parameters(connection_->GetCalledAet(), remoteModality_);
--- a/OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ThreadedInstancesLoader.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -87,7 +87,7 @@
 
     if (threadCount < 1)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     for (size_t i = 0; i < threadCount; i++)
--- a/OrthancServer/Sources/ServerJobs/ThreadedSetOfInstancesJob.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ThreadedSetOfInstancesJob.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -141,7 +141,7 @@
 
     if (!started_)
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (GetInstancesCount() == 0)
--- a/OrthancServer/Sources/StorageCommitmentReports.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/StorageCommitmentReports.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -128,7 +128,7 @@
         break;
 
       default:
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
 
     if (!pending)
--- a/OrthancServer/Sources/main.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/Sources/main.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -137,7 +137,7 @@
   {
     if (referencedSopClassUids.size() != referencedSopInstanceUids.size())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     std::unique_ptr<StorageCommitmentScpJob> job(
@@ -165,7 +165,7 @@
         failedSopClassUids.size() != failedSopInstanceUids.size() ||
         failedSopClassUids.size() != failureReasons.size())
     {
-      throw OrthancException(ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
     }
     
     std::unique_ptr<StorageCommitmentReports::Report> report(
--- a/OrthancServer/UnitTestsSources/ServerIndexTests.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/UnitTestsSources/ServerIndexTests.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -231,18 +231,18 @@
         virtual void SignalRemainingAncestor(ResourceType parentType,
                                              const std::string& publicId) ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual void SignalAttachmentDeleted(const FileInfo& info) ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual void SignalResourceDeleted(ResourceType type,
                                            const std::string& publicId) ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual void Commit() ORTHANC_OVERRIDE
@@ -257,30 +257,30 @@
         virtual bool IsUnstableResource(Orthanc::ResourceType type,
                                         int64_t id) ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual bool LookupRemainingLevel(std::string& remainingPublicId /* out */,
                                           ResourceType& remainingLevel   /* out */) ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual void MarkAsUnstable(Orthanc::ResourceType type,
                                     int64_t id,
                                     const std::string& publicId) ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual void SignalAttachmentsAdded(uint64_t compressedSize)  ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
 
         virtual void SignalChange(const ServerIndexChange& change)  ORTHANC_OVERRIDE
         {
-          throw OrthancException(ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
         }
       };
 
--- a/OrthancServer/UnitTestsSources/ServerJobsTests.cpp	Tue Jun 02 12:43:39 2026 +0200
+++ b/OrthancServer/UnitTestsSources/ServerJobsTests.cpp	Tue Jun 02 12:44:19 2026 +0200
@@ -145,7 +145,7 @@
 
     virtual void SetUserData(const Json::Value& userData) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     virtual bool GetUserData(Json::Value& userData) const ORTHANC_OVERRIDE
@@ -175,7 +175,7 @@
       {
         if (trailingStepDone_)
         {
-          throw OrthancException(ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
         }
         else
         {
@@ -185,7 +185,7 @@
       }
       else
       {
-        throw OrthancException(ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError);
       }
     }
 
@@ -224,7 +224,7 @@
 
     virtual void SetUserData(const Json::Value& userData) ORTHANC_OVERRIDE
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_NotImplemented);
     }
 
     virtual bool GetUserData(Json::Value& userData) const ORTHANC_OVERRIDE