comparison Core/HttpServer/MongooseServer.cpp @ 1570:2bd2c280f9b5

fix indentation
author jodogne
date Sun, 23 Aug 2015 11:13:03 +0200
parents 27774f6f84e4
children 3232f1c995a5
comparison
equal deleted inserted replaced
1569:27774f6f84e4 1570:2bd2c280f9b5
723 try 723 try
724 { 724 {
725 bool found = false; 725 bool found = false;
726 726
727 try 727 try
728 { 728 {
729 if (that->HasHandler()) 729 if (that->HasHandler())
730 { 730 {
731 found = that->GetHandler().Handle(output, method, uri, headers, argumentsGET, body.c_str(), body.size()); 731 found = that->GetHandler().Handle(output, method, uri, headers, argumentsGET, body.c_str(), body.size());
732 } 732 }
733 } 733 }
734 catch (boost::bad_lexical_cast&) 734 catch (boost::bad_lexical_cast&)
735 { 735 {
736 throw OrthancException(ErrorCode_BadParameterType); 736 throw OrthancException(ErrorCode_BadParameterType);
737 } 737 }
738 catch (std::runtime_error&) 738 catch (std::runtime_error&)
739 { 739 {
740 // Presumably an error while parsing the JSON body 740 // Presumably an error while parsing the JSON body
741 throw OrthancException(ErrorCode_BadRequest); 741 throw OrthancException(ErrorCode_BadRequest);
742 } 742 }
743 743
744 if (!found) 744 if (!found)
745 { 745 {
746 throw OrthancException(ErrorCode_UnknownResource); 746 throw OrthancException(ErrorCode_UnknownResource);
747 } 747 }
748 } 748 }
749 catch (OrthancException& e) 749 catch (OrthancException& e)
750 { 750 {
751 // Using this candidate handler results in an exception 751 // Using this candidate handler results in an exception
752 LOG(ERROR) << "Exception in the HTTP handler: " << e.What(); 752 LOG(ERROR) << "Exception in the HTTP handler: " << e.What();
755 755
756 try 756 try
757 { 757 {
758 switch (e.GetErrorCode()) 758 switch (e.GetErrorCode())
759 { 759 {
760 case ErrorCode_InexistentFile: 760 case ErrorCode_InexistentFile:
761 case ErrorCode_InexistentItem: 761 case ErrorCode_InexistentItem:
762 case ErrorCode_UnknownResource: 762 case ErrorCode_UnknownResource:
763 status = HttpStatus_404_NotFound; 763 status = HttpStatus_404_NotFound;
764 break; 764 break;
765 765
766 case ErrorCode_BadRequest: 766 case ErrorCode_BadRequest:
767 case ErrorCode_UriSyntax: 767 case ErrorCode_UriSyntax:
768 case ErrorCode_BadParameterType: 768 case ErrorCode_BadParameterType:
769 status = HttpStatus_400_BadRequest; 769 status = HttpStatus_400_BadRequest;
770 break; 770 break;
771 771
772 default: 772 default:
773 status = HttpStatus_500_InternalServerError; 773 status = HttpStatus_500_InternalServerError;