2012-01-19 03:58:32 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
2012-02-05 06:34:36 +00:00
|
|
|
|
using NLog;
|
2012-01-19 03:58:32 +00:00
|
|
|
|
using NzbDrone.Web.Models;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Web.Filters
|
|
|
|
|
{
|
|
|
|
|
public class JsonErrorFilter : FilterAttribute, IExceptionFilter
|
|
|
|
|
{
|
2012-02-05 06:34:36 +00:00
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
2012-01-19 03:58:32 +00:00
|
|
|
|
public void OnException(ExceptionContext filterContext)
|
|
|
|
|
{
|
2012-02-23 22:31:50 +00:00
|
|
|
|
filterContext.Result = JsonNotificationResult.Oops(filterContext.Exception.Message);
|
2012-01-19 03:58:32 +00:00
|
|
|
|
filterContext.ExceptionHandled = true;
|
2012-02-05 06:34:36 +00:00
|
|
|
|
logger.FatalException(filterContext.RequestContext.HttpContext.Request.RawUrl, filterContext.Exception);
|
2012-01-19 03:58:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|