440255 ensure 500 is logged on thrown Errors

This commit is contained in:
Greg Wilkins 2014-08-20 10:27:27 +10:00
parent 0331992d86
commit e15a87f499
2 changed files with 13 additions and 1 deletions

View File

@ -361,7 +361,10 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable, H
else
{
error=true;
throw e;
LOG.warn(String.valueOf(_uri), e);
_state.error(e);
_request.setHandled(true);
handleException(e);
}
}
catch (Exception e)

View File

@ -66,6 +66,9 @@ public class RequestLogHandler extends HandlerWrapper
@Override
public void onError(AsyncEvent event) throws IOException
{
HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse();
if (!response.isCommitted())
response.setStatus(500);
}
@ -91,6 +94,12 @@ public class RequestLogHandler extends HandlerWrapper
{
super.handle(target, baseRequest, request, response);
}
catch(Error|IOException|ServletException|RuntimeException e)
{
if (!response.isCommitted())
response.setStatus(500);
throw e;
}
finally
{
if (_requestLog != null && baseRequest.getDispatcherType().equals(DispatcherType.REQUEST))