make all error messages JSON

This commit is contained in:
Dennis Luxen
2014-04-09 18:12:45 -04:00
parent e91e6fb068
commit eaed8572f0
2 changed files with 7 additions and 13 deletions
+5 -11
View File
@@ -76,21 +76,15 @@ void RequestHandler::handle_request(const http::Request& req, http::Reply& rep){
if ( !result || (it != request.end()) ) {
rep = http::Reply::StockReply(http::Reply::badRequest);
rep.content.clear();
const int position = std::distance(request.begin(), it);
rep.content.push_back(
"{\"status\":400,\"status_message\":\"Query string malformed close to position "
);
std::string tmp_position_string;
intToString(position, tmp_position_string);
rep.content.push_back(
"Input seems to be malformed close to position "
"<br><pre>"
);
rep.content.push_back( request );
rep.content.push_back(tmp_position_string);
rep.content.push_back("<br>");
const unsigned end = std::distance(request.begin(), it);
for(unsigned i = 0; i < end; ++i) {
rep.content.push_back("&nbsp;");
}
rep.content.push_back("^<br></pre>");
rep.content.push_back("\"}");
} else {
//parsing done, lets call the right plugin to handle the request
BOOST_ASSERT_MSG(