changeset 1758:4ee11b8773e2

Better error description in case of network json payload errors
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 26 Apr 2021 20:41:38 +0200
parents 28979b77ce90
children 7428da2bb94d
files OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp	Mon Apr 26 17:37:54 2021 +0200
+++ b/OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp	Mon Apr 26 20:41:38 2021 +0200
@@ -149,7 +149,7 @@
         }
         const std::string msgStr = msg.str();
         LOG(ERROR) << msgStr;
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource);          
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_BadJson);
       }
 
       const std::string instanceId = lookup[0]["ID"].asString();
--- a/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp	Mon Apr 26 17:37:54 2021 +0200
+++ b/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp	Mon Apr 26 20:41:38 2021 +0200
@@ -92,7 +92,7 @@
         
       if (body.type() != Json::objectValue)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_BadJson, "JSON body should be an object value");
       }
 
       std::unique_ptr<Orthanc::DicomMap> dicom(new Orthanc::DicomMap);
--- a/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Mon Apr 26 17:37:54 2021 +0200
+++ b/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Mon Apr 26 20:41:38 2021 +0200
@@ -350,7 +350,7 @@
       
     if (body.type() != Json::objectValue)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_BadJson, "JSON body should be an object value");
     }
 
     {
@@ -574,11 +574,11 @@
   OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()
   {
     LOG(TRACE) << "OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()";
-  }
-
-  void OrthancSeriesVolumeProgressiveLoader::SetStartCenter(bool startCenter)
-  {
-      startCenter_ = startCenter;
+  }
+
+  void OrthancSeriesVolumeProgressiveLoader::SetStartCenter(bool startCenter)
+  {
+      startCenter_ = startCenter;
   }
 
   void OrthancSeriesVolumeProgressiveLoader::SetSimultaneousDownloads(unsigned int count)