diff Core/HttpServer/MongooseServer.cpp @ 1567:9c5d93510414

If error while calling the REST API, the answer body contains an error description
author jodogne
date Sun, 23 Aug 2015 09:49:16 +0200
parents 3606278d305e
children 818ae9bc493a
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp	Fri Aug 21 17:37:13 2015 +0200
+++ b/Core/HttpServer/MongooseServer.cpp	Sun Aug 23 09:49:16 2015 +0200
@@ -749,7 +749,7 @@
             break;
 
           default:
-            output.SendStatus(HttpStatus_500_InternalServerError);
+            output.SendStatus(HttpStatus_500_InternalServerError, e.What());
         }
       }
       catch (OrthancException&)
@@ -763,13 +763,13 @@
     catch (boost::bad_lexical_cast&)
     {
       LOG(ERROR) << "Exception in the HTTP handler: Bad lexical cast";
-      output.SendStatus(HttpStatus_400_BadRequest);
+      output.SendStatus(HttpStatus_400_BadRequest, "Cannot cast some argument");
       return;
     }
     catch (std::runtime_error&)
     {
       LOG(ERROR) << "Exception in the HTTP handler: Presumably a bad JSON request";
-      output.SendStatus(HttpStatus_400_BadRequest);
+      output.SendStatus(HttpStatus_400_BadRequest, "Bad JSON request");
       return;
     }