mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
NzbDroneErrorPipeline uses the new aggregate exceptions.
This commit is contained in:
parent
5f8c6da9d9
commit
e0fb77a521
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user