started to remove iisexpress.

This commit is contained in:
Keivan Beigi 2013-02-18 17:13:42 -08:00
commit 68128809c9
39 changed files with 383 additions and 820 deletions

View file

@ -0,0 +1,38 @@
using System;
using System.Linq;
using NLog;
using Nancy;
using NzbDrone.Api.Extentions;
namespace NzbDrone.Api.ErrorManagement
{
public class ErrorPipeline
{
private readonly Logger _logger;
public ErrorPipeline(Logger logger)
{
_logger = logger;
}
public Response HandleException(NancyContext context, Exception exception)
{
var apiException = exception as ApiException;
if (apiException != null)
{
_logger.WarnException("API Error", apiException);
return apiException.ToErrorResponse();
}
_logger.ErrorException("Unexpected error", exception);
return new ErrorModel()
{
Message = exception.Message,
Description = exception.ToString()
}.AsResponse(HttpStatusCode.InternalServerError);
}
}
}