comparison Core/HttpServer/MongooseServer.cpp @ 1438:af112b7d9cba

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2015 09:56:41 +0200
parents ad94a3583b07
children f3672356c121
comparison
equal deleted inserted replaced
1437:02f5a3f5c0a0 1438:af112b7d9cba
694 catch (OrthancException& e) 694 catch (OrthancException& e)
695 { 695 {
696 // Using this candidate handler results in an exception 696 // Using this candidate handler results in an exception
697 LOG(ERROR) << "Exception in the HTTP handler: " << e.What(); 697 LOG(ERROR) << "Exception in the HTTP handler: " << e.What();
698 698
699 switch (e.GetErrorCode()) 699 try
700 { 700 {
701 case ErrorCode_InexistentFile: 701 switch (e.GetErrorCode())
702 case ErrorCode_InexistentItem: 702 {
703 case ErrorCode_UnknownResource: 703 case ErrorCode_InexistentFile:
704 output.SendStatus(HttpStatus_404_NotFound); 704 case ErrorCode_InexistentItem:
705 break; 705 case ErrorCode_UnknownResource:
706 706 output.SendStatus(HttpStatus_404_NotFound);
707 case ErrorCode_BadRequest: 707 break;
708 case ErrorCode_UriSyntax: 708
709 output.SendStatus(HttpStatus_400_BadRequest); 709 case ErrorCode_BadRequest:
710 break; 710 case ErrorCode_UriSyntax:
711 711 output.SendStatus(HttpStatus_400_BadRequest);
712 default: 712 break;
713 output.SendStatus(HttpStatus_500_InternalServerError); 713
714 default:
715 output.SendStatus(HttpStatus_500_InternalServerError);
716 }
717 }
718 catch (OrthancException&)
719 {
720 // An exception here reflects the fact that an exception was
721 // triggered after the status code was sent by the HTTP handler.
714 } 722 }
715 723
716 return; 724 return;
717 } 725 }
718 catch (boost::bad_lexical_cast&) 726 catch (boost::bad_lexical_cast&)