1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 01:11:43 +00:00

NzbDroneErrorPipeline uses the new aggregate exceptions.

This commit is contained in:
kay.one 2013-09-19 00:16:59 -07:00
parent 5f8c6da9d9
commit e0fb77a521

View file

@ -17,9 +17,11 @@ public NzbDroneErrorPipeline(Logger logger)
_logger = logger;
}
public Response HandleException(NancyContext context, Exception exception)
public Response HandleException(NancyContext context, Exception aggregateException)
{
var apiException = exception as ApiException;
var innerException = (aggregateException.InnerException).InnerException;
var apiException = innerException as ApiException;
if (apiException != null)
{
@ -27,7 +29,7 @@ public Response HandleException(NancyContext context, Exception exception)
return apiException.ToErrorResponse();
}
var validationException = exception as ValidationException;
var validationException = innerException as ValidationException;
if (validationException != null)
{
@ -36,23 +38,23 @@ public Response HandleException(NancyContext context, Exception exception)
return validationException.Errors.AsResponse(HttpStatusCode.BadRequest);
}
var clientException = exception as NzbDroneClientException;
var clientException = innerException as NzbDroneClientException;
if (clientException != null)
{
return new ErrorModel
{
Message = exception.Message,
Description = exception.ToString()
Message = innerException.Message,
Description = innerException.ToString()
}.AsResponse((HttpStatusCode)clientException.StatusCode);
}
_logger.FatalException("Request Failed", exception);
_logger.FatalException("Request Failed", innerException);
return new ErrorModel
{
Message = exception.Message,
Description = exception.ToString()
Message = innerException.Message,
Description = innerException.ToString()
}.AsResponse(HttpStatusCode.InternalServerError);
}
}