Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp Tue Jun 30 18:41:33 2015 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Wed Jul 01 09:56:41 2015 +0200 @@ -696,21 +696,29 @@ // Using this candidate handler results in an exception LOG(ERROR) << "Exception in the HTTP handler: " << e.What(); - switch (e.GetErrorCode()) + try { - case ErrorCode_InexistentFile: - case ErrorCode_InexistentItem: - case ErrorCode_UnknownResource: - output.SendStatus(HttpStatus_404_NotFound); - break; + switch (e.GetErrorCode()) + { + case ErrorCode_InexistentFile: + case ErrorCode_InexistentItem: + case ErrorCode_UnknownResource: + output.SendStatus(HttpStatus_404_NotFound); + break; - case ErrorCode_BadRequest: - case ErrorCode_UriSyntax: - output.SendStatus(HttpStatus_400_BadRequest); - break; + case ErrorCode_BadRequest: + case ErrorCode_UriSyntax: + output.SendStatus(HttpStatus_400_BadRequest); + break; - default: - output.SendStatus(HttpStatus_500_InternalServerError); + default: + output.SendStatus(HttpStatus_500_InternalServerError); + } + } + catch (OrthancException&) + { + // An exception here reflects the fact that an exception was + // triggered after the status code was sent by the HTTP handler. } return;