changeset 4608:de5e6b04442d db-changes

added ErrorCode_Revision
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 31 Mar 2021 14:34:41 +0200
parents f75c63aa9de0
children 37de0a5ebe86
files OrthancFramework/Resources/CodeGeneration/ErrorCodes.json OrthancFramework/Sources/Enumerations.cpp OrthancFramework/Sources/Enumerations.h OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h OrthancServer/Sources/main.cpp
diffstat 5 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CodeGeneration/ErrorCodes.json	Tue Mar 30 18:10:27 2021 +0200
+++ b/OrthancFramework/Resources/CodeGeneration/ErrorCodes.json	Wed Mar 31 14:34:41 2021 +0200
@@ -239,6 +239,12 @@
     "Name": "DatabaseCannotSerialize",
     "Description": "Database could not serialize access due to concurrent update, the transaction should be retried"
   }, 
+  {
+    "Code": 43,
+    "HttpStatus": 409,
+    "Name": "Revision",
+    "Description": "A bad revision number was provided, indicates conflict between multiple updates"
+  }, 
 
 
 
--- a/OrthancFramework/Sources/Enumerations.cpp	Tue Mar 30 18:10:27 2021 +0200
+++ b/OrthancFramework/Sources/Enumerations.cpp	Wed Mar 31 14:34:41 2021 +0200
@@ -190,6 +190,9 @@
       case ErrorCode_DatabaseCannotSerialize:
         return "Database could not serialize access due to concurrent update, the transaction should be retried";
 
+      case ErrorCode_Revision:
+        return "A bad revision number was provided, indicates conflict between multiple updates";
+
       case ErrorCode_SQLiteNotOpened:
         return "SQLite: The database is not opened";
 
@@ -2147,6 +2150,9 @@
       case ErrorCode_DatabaseCannotSerialize:
         return HttpStatus_503_ServiceUnavailable;
 
+      case ErrorCode_Revision:
+        return HttpStatus_409_Conflict;
+
       case ErrorCode_CreateDicomNotString:
         return HttpStatus_400_BadRequest;
 
--- a/OrthancFramework/Sources/Enumerations.h	Tue Mar 30 18:10:27 2021 +0200
+++ b/OrthancFramework/Sources/Enumerations.h	Wed Mar 31 14:34:41 2021 +0200
@@ -136,6 +136,7 @@
     ErrorCode_DiscontinuedAbi = 40    /*!< Calling a function that has been removed from the Orthanc Framework */,
     ErrorCode_BadRange = 41    /*!< Incorrect range request */,
     ErrorCode_DatabaseCannotSerialize = 42    /*!< Database could not serialize access due to concurrent update, the transaction should be retried */,
+    ErrorCode_Revision = 43    /*!< A bad revision number was provided, indicates conflict between multiple updates */,
     ErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     ErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     ErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Mar 30 18:10:27 2021 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Mar 31 14:34:41 2021 +0200
@@ -240,6 +240,7 @@
     OrthancPluginErrorCode_DiscontinuedAbi = 40    /*!< Calling a function that has been removed from the Orthanc Framework */,
     OrthancPluginErrorCode_BadRange = 41    /*!< Incorrect range request */,
     OrthancPluginErrorCode_DatabaseCannotSerialize = 42    /*!< Database could not serialize access due to concurrent update, the transaction should be retried */,
+    OrthancPluginErrorCode_Revision = 43    /*!< A bad revision number was provided, indicates conflict between multiple updates */,
     OrthancPluginErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     OrthancPluginErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
--- a/OrthancServer/Sources/main.cpp	Tue Mar 30 18:10:27 2021 +0200
+++ b/OrthancServer/Sources/main.cpp	Wed Mar 31 14:34:41 2021 +0200
@@ -724,6 +724,7 @@
     PrintErrorCode(ErrorCode_DiscontinuedAbi, "Calling a function that has been removed from the Orthanc Framework");
     PrintErrorCode(ErrorCode_BadRange, "Incorrect range request");
     PrintErrorCode(ErrorCode_DatabaseCannotSerialize, "Database could not serialize access due to concurrent update, the transaction should be retried");
+    PrintErrorCode(ErrorCode_Revision, "A bad revision number was provided, indicates conflict between multiple updates");
     PrintErrorCode(ErrorCode_SQLiteNotOpened, "SQLite: The database is not opened");
     PrintErrorCode(ErrorCode_SQLiteAlreadyOpened, "SQLite: Connection is already open");
     PrintErrorCode(ErrorCode_SQLiteCannotOpen, "SQLite: Unable to open the database");