changeset 3191:20826867141f

ignore jobs that cannot be unserialized
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Feb 2019 21:09:44 +0100
parents f451e93cd58b
children 595bfee4391a
files Core/JobsEngine/JobsRegistry.cpp
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Core/JobsEngine/JobsRegistry.cpp	Mon Feb 04 20:30:08 2019 +0100
+++ b/Core/JobsEngine/JobsRegistry.cpp	Mon Feb 04 21:09:44 2019 +0100
@@ -1379,7 +1379,18 @@
     for (Json::Value::Members::const_iterator it = members.begin();
          it != members.end(); ++it)
     {
-      std::auto_ptr<JobHandler> job(new JobHandler(unserializer, s[JOBS][*it], *it));
+      std::auto_ptr<JobHandler> job;
+
+      try
+      {
+        job.reset(new JobHandler(unserializer, s[JOBS][*it], *it));
+      }
+      catch (OrthancException& e)
+      {
+        LOG(WARNING) << "Cannot unserialize one job from previous execution, "
+                     << "skipping it: " << e.What();
+        continue;
+      }
 
       const boost::posix_time::ptime lastChangeTime = job->GetLastStateChangeTime();