diff OrthancServer/OrthancInitialization.cpp @ 2799:6e3a60b85da6

New primitives to access Orthanc peers from plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Aug 2018 16:55:07 +0200
parents 0196d07a900f
children dc7330089736
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp	Tue Aug 21 10:42:16 2018 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Wed Aug 22 16:55:07 2018 +0200
@@ -608,16 +608,14 @@
   }
 
 
-
-  void Configuration::GetOrthancPeer(WebServiceParameters& peer,
+  bool Configuration::GetOrthancPeer(WebServiceParameters& peer,
                                      const std::string& name)
   {
     boost::recursive_mutex::scoped_lock lock(globalMutex_);
 
     if (!configuration_.isMember("OrthancPeers"))
     {
-      LOG(ERROR) << "No peer with symbolic name: " << name;
-      throw OrthancException(ErrorCode_InexistentItem);
+      return false;
     }
 
     try
@@ -626,11 +624,13 @@
       if (modalities.type() != Json::objectValue ||
           !modalities.isMember(name))
       {
-        LOG(ERROR) << "No peer with symbolic name: " << name;
-        throw OrthancException(ErrorCode_InexistentItem);
+        return false;
       }
-
-      peer.FromJson(modalities[name]);
+      else
+      {
+        peer.FromJson(modalities[name]);
+        return true;
+      }
     }
     catch (OrthancException&)
     {