diff OrthancServer/LuaScripting.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 3a55b77339ff
children 4767d36679ed
line wrap: on
line diff
--- a/OrthancServer/LuaScripting.cpp	Tue Aug 21 10:42:16 2018 +0200
+++ b/OrthancServer/LuaScripting.cpp	Wed Aug 22 16:55:07 2018 +0200
@@ -456,9 +456,15 @@
       std::string name = parameters["Peer"].asString();
 
       WebServiceParameters peer;
-      Configuration::GetOrthancPeer(peer, name);
-
-      return lock.AddStorePeerOperation(peer);
+      if (Configuration::GetOrthancPeer(peer, name))
+      {
+        return lock.AddStorePeerOperation(peer);
+      }
+      else
+      {
+        LOG(ERROR) << "No peer with symbolic name: " << name;
+        throw OrthancException(ErrorCode_UnknownResource);
+      }
     }
 
     if (operation == "modify")