changeset 5037:3444990cf295

cleanup
author Alain Mazy <am@osimis.io>
date Fri, 24 Jun 2022 16:16:43 +0200
parents 877bc3b96476
children f8bea9c1c0fc
files OrthancFramework/Sources/Enumerations.cpp OrthancServer/Sources/OrthancInitialization.cpp
diffstat 2 files changed, 2 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/Enumerations.cpp	Fri Jun 24 15:47:10 2022 +0200
+++ b/OrthancFramework/Sources/Enumerations.cpp	Fri Jun 24 16:16:43 2022 +0200
@@ -1311,7 +1311,7 @@
       return ResourceType_Instance;
     }
 
-    throw OrthancException(ErrorCode_ParameterOutOfRange);
+    throw OrthancException(ErrorCode_ParameterOutOfRange, std::string("Invalid resource type '") + type + "'");
   }
 
   const char* ResourceTypeToDicomQueryRetrieveLevel(ResourceType type)
--- a/OrthancServer/Sources/OrthancInitialization.cpp	Fri Jun 24 15:47:10 2022 +0200
+++ b/OrthancServer/Sources/OrthancInitialization.cpp	Fri Jun 24 16:16:43 2022 +0200
@@ -215,27 +215,7 @@
 
     for (Json::Value::ArrayIndex i = 0; i < levels.size(); i++)
     {
-      ResourceType level;
-      if (levels[i] == "Patient")
-      {
-        level = ResourceType_Patient;
-      }
-      else if (levels[i] == "Study")
-      {
-        level = ResourceType_Study;
-      }
-      else if (levels[i] == "Series")
-      {
-        level = ResourceType_Series;
-      }
-      else if (levels[i] == "Instance")
-      {
-        level = ResourceType_Instance;
-      }
-      else
-      {
-        throw OrthancException(ErrorCode_BadFileFormat, "Unknown entry '" + levels[i] + "' in ExtraMainDicomTags.");
-      }
+      ResourceType level = StringToResourceType(levels[i].c_str());
 
       const Json::Value& content = configuration[EXTRA_MAIN_DICOM_TAGS][levels[i]];