diff Core/DicomNetworking/DicomUserConnection.cpp @ 3800:38b0f51781aa

improved error message when trying to execute a C-Find query that is not accepted by the remote modality
author Alain Mazy <alain@mazy.be>
date Wed, 01 Apr 2020 11:08:43 +0200
parents 320a2d224902
children 7f083dfae62b
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Wed Apr 01 10:15:33 2020 +0200
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Wed Apr 01 11:08:43 2020 +0200
@@ -736,9 +736,22 @@
     {
       char buf[16];
       sprintf(buf, "%04X", response.DimseStatus);
-      throw OrthancException(ErrorCode_NetworkProtocol,
-                             "C-FIND SCU to AET \"" + remoteAet +
-                             "\" has failed with DIMSE status 0x" + buf);
+
+      if (response.DimseStatus == STATUS_FIND_Failed_UnableToProcess)
+      {
+        throw OrthancException(ErrorCode_NetworkProtocol,
+                               HttpStatus_422_UnprocessableEntity,
+                               "C-FIND SCU to AET \"" + remoteAet +
+                               "\" has failed with DIMSE status 0x" + buf +
+                               " (unable to process - invalid query ?)"
+                               );
+      }
+      else
+      {
+        throw OrthancException(ErrorCode_NetworkProtocol,
+                               "C-FIND SCU to AET \"" + remoteAet +
+                               "\" has failed with DIMSE status 0x" + buf);
+      }
     }
 
   }