# HG changeset patch # User jodogne # Date 1440316523 -7200 # Node ID 818ae9bc493aad87f860379e5136cf53e7f71236 # Parent 9c5d93510414ee65cd595b237855ea3eedd5b275 error description in json diff -r 9c5d93510414 -r 818ae9bc493a Core/HttpServer/MongooseServer.cpp --- a/Core/HttpServer/MongooseServer.cpp Sun Aug 23 09:49:16 2015 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Sun Aug 23 09:55:23 2015 +0200 @@ -749,7 +749,14 @@ break; default: - output.SendStatus(HttpStatus_500_InternalServerError, e.What()); + { + Json::Value message = Json::objectValue; + message["ErrorCode"] = e.GetErrorCode(); + message["Description"] = e.GetDescription(e.GetErrorCode()); + message["Message"] = e.What(); + std::string s = message.toStyledString(); + output.SendStatus(HttpStatus_500_InternalServerError, s); + } } } catch (OrthancException&) diff -r 9c5d93510414 -r 818ae9bc493a Core/OrthancException.cpp --- a/Core/OrthancException.cpp Sun Aug 23 09:49:16 2015 +0200 +++ b/Core/OrthancException.cpp Sun Aug 23 09:55:23 2015 +0200 @@ -134,8 +134,10 @@ return "Error with the database engine"; case ErrorCode_Custom: + return "See the attached error message"; + default: - return "???"; + return "Unknown error code"; } } }