# HG changeset patch # User Sebastien Jodogne # Date 1440682603 -7200 # Node ID f2e3d030ea59b61c2af50b46edd987775d0810bd # Parent e1e54a73ba8bd6fd399e62a80139459f96e15339 BadJson error code diff -r e1e54a73ba8b -r f2e3d030ea59 Core/Enumerations.cpp --- a/Core/Enumerations.cpp Thu Aug 27 14:58:58 2015 +0200 +++ b/Core/Enumerations.cpp Thu Aug 27 15:36:43 2015 +0200 @@ -133,6 +133,9 @@ case ErrorCode_UnknownDicomTag: return "Unknown DICOM tag"; + case ErrorCode_BadJson: + return "Cannot parse a JSON document"; + case ErrorCode_SQLiteNotOpened: return "SQLite: The database is not opened"; @@ -1118,6 +1121,9 @@ case ErrorCode_InexistentTag: return HttpStatus_404_NotFound; + case ErrorCode_BadJson: + return HttpStatus_400_BadRequest; + default: return HttpStatus_500_InternalServerError; } diff -r e1e54a73ba8b -r f2e3d030ea59 Core/Enumerations.h --- a/Core/Enumerations.h Thu Aug 27 14:58:58 2015 +0200 +++ b/Core/Enumerations.h Thu Aug 27 15:36:43 2015 +0200 @@ -74,6 +74,7 @@ ErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */, ErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */, ErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */, + ErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */, 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 */, diff -r e1e54a73ba8b -r f2e3d030ea59 Core/Lua/LuaContext.cpp --- a/Core/Lua/LuaContext.cpp Thu Aug 27 14:58:58 2015 +0200 +++ b/Core/Lua/LuaContext.cpp Thu Aug 27 15:36:43 2015 +0200 @@ -557,7 +557,7 @@ Json::Reader reader; if (!reader.parse(s, output)) { - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadJson); } } diff -r e1e54a73ba8b -r f2e3d030ea59 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Thu Aug 27 14:58:58 2015 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Thu Aug 27 15:36:43 2015 +0200 @@ -137,8 +137,8 @@ if (!reader.parse(content, tmp) || tmp.type() != Json::objectValue) { - LOG(ERROR) << "Bad file format for this configuration file: " << path; - throw OrthancException(ErrorCode_BadFileFormat); + LOG(ERROR) << "The configuration file does not follow the JSON syntax: " << path; + throw OrthancException(ErrorCode_BadJson); } Toolbox::CopyJsonWithoutComments(config, tmp); diff -r e1e54a73ba8b -r f2e3d030ea59 Plugins/Include/orthanc/OrthancCPlugin.h --- a/Plugins/Include/orthanc/OrthancCPlugin.h Thu Aug 27 14:58:58 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Thu Aug 27 15:36:43 2015 +0200 @@ -192,6 +192,7 @@ OrthancPluginErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */, OrthancPluginErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */, OrthancPluginErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */, + OrthancPluginErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */, 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 */, diff -r e1e54a73ba8b -r f2e3d030ea59 Resources/ErrorCodes.json --- a/Resources/ErrorCodes.json Thu Aug 27 14:58:58 2015 +0200 +++ b/Resources/ErrorCodes.json Thu Aug 27 15:36:43 2015 +0200 @@ -160,8 +160,9 @@ }, { "Code": 28, - "Name": "RegularFileExpected", - "Description": "The path does not point to a regular file" + "HttpStatus": 400, + "Name": "BadJson", + "Description": "Cannot parse a JSON document" },