diff OrthancServer/Scheduler/DeleteInstanceCommand.cpp @ 1099:060e8918d7a4

More fault-tolerant commands in Lua scripts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 Aug 2014 10:02:22 +0200
parents 52e71b25f9ce
children 0479d02c6778
line wrap: on
line diff
--- a/OrthancServer/Scheduler/DeleteInstanceCommand.cpp	Tue Aug 05 16:18:45 2014 +0200
+++ b/OrthancServer/Scheduler/DeleteInstanceCommand.cpp	Thu Aug 07 10:02:22 2014 +0200
@@ -44,8 +44,15 @@
     {
       LOG(INFO) << "Deleting instance " << *it;
 
-      Json::Value tmp;
-      context_.GetIndex().DeleteResource(tmp, *it, ResourceType_Instance);
+      try
+      {
+        Json::Value tmp;
+        context_.GetIndex().DeleteResource(tmp, *it, ResourceType_Instance);
+      }
+      catch (OrthancException& e)
+      {
+        LOG(ERROR) << "Unable to delete instance " << *it << " in a Lua script: " << e.What();
+      }
     }
 
     return true;