comparison 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
comparison
equal deleted inserted replaced
1567:9c5d93510414 1568:818ae9bc493a
747 case ErrorCode_UriSyntax: 747 case ErrorCode_UriSyntax:
748 output.SendStatus(HttpStatus_400_BadRequest); 748 output.SendStatus(HttpStatus_400_BadRequest);
749 break; 749 break;
750 750
751 default: 751 default:
752 output.SendStatus(HttpStatus_500_InternalServerError, e.What()); 752 {
753 Json::Value message = Json::objectValue;
754 message["ErrorCode"] = e.GetErrorCode();
755 message["Description"] = e.GetDescription(e.GetErrorCode());
756 message["Message"] = e.What();
757 std::string s = message.toStyledString();
758 output.SendStatus(HttpStatus_500_InternalServerError, s);
759 }
753 } 760 }
754 } 761 }
755 catch (OrthancException&) 762 catch (OrthancException&)
756 { 763 {
757 // An exception here reflects the fact that an exception was 764 // An exception here reflects the fact that an exception was