comparison 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
comparison
equal deleted inserted replaced
1566:3be6eb3757c8 1567:9c5d93510414
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); 752 output.SendStatus(HttpStatus_500_InternalServerError, e.What());
753 } 753 }
754 } 754 }
755 catch (OrthancException&) 755 catch (OrthancException&)
756 { 756 {
757 // An exception here reflects the fact that an exception was 757 // An exception here reflects the fact that an exception was
761 return; 761 return;
762 } 762 }
763 catch (boost::bad_lexical_cast&) 763 catch (boost::bad_lexical_cast&)
764 { 764 {
765 LOG(ERROR) << "Exception in the HTTP handler: Bad lexical cast"; 765 LOG(ERROR) << "Exception in the HTTP handler: Bad lexical cast";
766 output.SendStatus(HttpStatus_400_BadRequest); 766 output.SendStatus(HttpStatus_400_BadRequest, "Cannot cast some argument");
767 return; 767 return;
768 } 768 }
769 catch (std::runtime_error&) 769 catch (std::runtime_error&)
770 { 770 {
771 LOG(ERROR) << "Exception in the HTTP handler: Presumably a bad JSON request"; 771 LOG(ERROR) << "Exception in the HTTP handler: Presumably a bad JSON request";
772 output.SendStatus(HttpStatus_400_BadRequest); 772 output.SendStatus(HttpStatus_400_BadRequest, "Bad JSON request");
773 return; 773 return;
774 } 774 }
775 775
776 if (!found) 776 if (!found)
777 { 777 {