Mercurial > hg > orthanc
changeset 2486:ad8f30fc28d1
new error code: DatabaseUnavailable
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 07 Mar 2018 15:46:47 +0100 |
parents | a5196a7d98c6 |
children | be1dbb1dcdd6 |
files | Core/Enumerations.cpp Core/Enumerations.h NEWS OrthancServer/main.cpp Plugins/Include/orthanc/OrthancCPlugin.h Resources/ErrorCodes.json |
diffstat | 6 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/Enumerations.cpp Tue Mar 06 10:41:05 2018 +0100 +++ b/Core/Enumerations.cpp Wed Mar 07 15:46:47 2018 +0100 @@ -161,6 +161,9 @@ case ErrorCode_NullPointer: return "Cannot handle a NULL pointer"; + case ErrorCode_DatabaseUnavailable: + return "The database is currently not available (probably a transient situation)"; + case ErrorCode_SQLiteNotOpened: return "SQLite: The database is not opened"; @@ -1617,6 +1620,9 @@ case ErrorCode_NotAcceptable: return HttpStatus_406_NotAcceptable; + case ErrorCode_DatabaseUnavailable: + return HttpStatus_503_ServiceUnavailable; + default: return HttpStatus_500_InternalServerError; }
--- a/Core/Enumerations.h Tue Mar 06 10:41:05 2018 +0100 +++ b/Core/Enumerations.h Wed Mar 07 15:46:47 2018 +0100 @@ -85,6 +85,7 @@ ErrorCode_EmptyRequest = 33 /*!< The request is empty */, ErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */, ErrorCode_NullPointer = 35 /*!< Cannot handle a NULL pointer */, + ErrorCode_DatabaseUnavailable = 36 /*!< The database is currently not available (probably a transient situation) */, 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/NEWS Tue Mar 06 10:41:05 2018 +0100 +++ b/NEWS Wed Mar 07 15:46:47 2018 +0100 @@ -18,6 +18,11 @@ * New CMake option: "-DENABLE_LUA_MODULES=ON" to enable support for loading external Lua modules if the Lua engine is statically linked +Plugins +------- + +* New error code: DatabaseUnavailable + Maintenance -----------
--- a/OrthancServer/main.cpp Tue Mar 06 10:41:05 2018 +0100 +++ b/OrthancServer/main.cpp Wed Mar 07 15:46:47 2018 +0100 @@ -573,6 +573,7 @@ PrintErrorCode(ErrorCode_EmptyRequest, "The request is empty"); PrintErrorCode(ErrorCode_NotAcceptable, "Cannot send a response which is acceptable according to the Accept HTTP header"); PrintErrorCode(ErrorCode_NullPointer, "Cannot handle a NULL pointer"); + PrintErrorCode(ErrorCode_DatabaseUnavailable, "The database is currently not available (probably a transient situation)"); 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");
--- a/Plugins/Include/orthanc/OrthancCPlugin.h Tue Mar 06 10:41:05 2018 +0100 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Wed Mar 07 15:46:47 2018 +0100 @@ -118,7 +118,7 @@ #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 3 -#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 1 +#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 2 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) @@ -234,6 +234,7 @@ OrthancPluginErrorCode_EmptyRequest = 33 /*!< The request is empty */, OrthancPluginErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */, OrthancPluginErrorCode_NullPointer = 35 /*!< Cannot handle a NULL pointer */, + OrthancPluginErrorCode_DatabaseUnavailable = 36 /*!< The database is currently not available (probably a transient situation) */, 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/Resources/ErrorCodes.json Tue Mar 06 10:41:05 2018 +0100 +++ b/Resources/ErrorCodes.json Wed Mar 07 15:46:47 2018 +0100 @@ -201,6 +201,12 @@ "Name": "NullPointer", "Description": "Cannot handle a NULL pointer" }, + { + "Code": 36, + "HttpStatus": 503, + "Name": "DatabaseUnavailable", + "Description": "The database is currently not available (probably a transient situation)" + },