1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-29 03:15:19 +00:00
Radarr/NzbDrone.Api/ErrorManagment/ErrorPipeline.cs
kay.one c184595935 added Nancy pipelines for error handling,
cleaned up container registrations.
2013-02-15 16:52:04 -08:00

28 lines
No EOL
680 B
C#

using System;
using System.Linq;
using NLog;
using Nancy;
namespace NzbDrone.Api.ErrorManagment
{
public class ErrorPipeline
{
private readonly Logger _logger;
public ErrorPipeline(Logger logger)
{
_logger = logger;
}
public Response HandleException(NancyContext context, Exception exception)
{
if (exception is ApiException)
{
_logger.WarnException("API Error", exception);
return ((ApiException)exception).ToErrorResponse();
}
_logger.ErrorException("Unexpected error", exception);
return null;
}
}
}