diff Core/HttpServer/MongooseServer.cpp @ 1568:818ae9bc493a

error description in json
author jodogne
date Sun, 23 Aug 2015 09:55:23 +0200
parents 9c5d93510414
children 27774f6f84e4
line wrap: on
line diff
--- 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&)