changeset 5624:790335c99713

more detailed error message for 'Cannot write DICOM file to memory'
author Alain Mazy <am@orthanc.team>
date Tue, 14 May 2024 09:47:50 +0200
parents 1a995c6f9dae
children 72dcf3a8d7d5
files OrthancServer/Plugins/Samples/MultitenantDicom/StoreRequestHandler.cpp OrthancServer/Sources/DicomInstanceToStore.cpp
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Samples/MultitenantDicom/StoreRequestHandler.cpp	Thu May 09 10:43:10 2024 +0200
+++ b/OrthancServer/Plugins/Samples/MultitenantDicom/StoreRequestHandler.cpp	Tue May 14 09:47:50 2024 +0200
@@ -38,10 +38,11 @@
                                      const std::string& calledAet)
 {
   std::string buffer;
+  std::string errorMessage;
 
-  if (!Orthanc::FromDcmtkBridge::SaveToMemoryBuffer(buffer, dicom))
+  if (!Orthanc::FromDcmtkBridge::SaveToMemoryBuffer(buffer, dicom, errorMessage))
   {
-    LOG(ERROR) << "Cannot write DICOM file to memory";
+    LOG(ERROR) << "Cannot write DICOM file to memory: " << errorMessage;
     return STATUS_STORE_Error_CannotUnderstand;
   }
 
--- a/OrthancServer/Sources/DicomInstanceToStore.cpp	Thu May 09 10:43:10 2024 +0200
+++ b/OrthancServer/Sources/DicomInstanceToStore.cpp	Tue May 14 09:47:50 2024 +0200
@@ -132,9 +132,10 @@
       {
         buffer_.reset(new std::string);
         
-        if (!FromDcmtkBridge::SaveToMemoryBuffer(*buffer_, dataset_))
+        std::string errorMessage;
+        if (!FromDcmtkBridge::SaveToMemoryBuffer(*buffer_, dataset_, errorMessage))
         {
-          throw OrthancException(ErrorCode_InternalError, "Cannot write DICOM file to memory");
+          throw OrthancException(ErrorCode_InternalError, "Cannot write DICOM file to memory: " + errorMessage);
         }
       }
     }