diff Core/JobsEngine/JobsRegistry.cpp @ 3162:94a4f75cc746

Fix issue #119 (/patients/.../archive returns a 500 when JobsHistorySize is 0)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Jan 2019 16:47:05 +0100
parents 4e43e67f8ecf
children 053e72ff9fc5
line wrap: on
line diff
--- a/Core/JobsEngine/JobsRegistry.cpp	Thu Jan 24 16:16:56 2019 +0100
+++ b/Core/JobsEngine/JobsRegistry.cpp	Thu Jan 24 16:47:05 2019 +0100
@@ -755,9 +755,11 @@
       {
         if (!GetStateInternal(state, id))
         {
-          // Job has finished and has been lost (should not happen)
-          state = JobState_Failure;
-          break;
+          // Job has finished and has been lost (typically happens if
+          // "JobsHistorySize" is 0)
+          throw OrthancException(ErrorCode_InexistentItem,
+                                 "Cannot retrieve the status of the job, "
+                                 "make sure that \"JobsHistorySize\" is not 0");
         }
         else if (state == JobState_Failure)
         {