{
if (((Failure) e).isLoggable())
logger.error("Failed executing " + request.getHttpMethod() + " " + request.getUri().getPath(), e);
else logger.debug("Failed executing " + request.getHttpMethod() + " " + request.getUri().getPath(), e);
Failure failure = (Failure) e;
if (failure.getResponse() != null)
{
writeFailure(response, failure.getResponse());
}
else
{
try
{
if (failure.getMessage() != null)
{
response.sendError(failure.getErrorCode(), failure.getMessage());
}
else
{
response.sendError(failure.getErrorCode());
}
}
catch (IOException e1)
{
throw new UnhandledException(e1);