ExceptionContext.ExceptionHandled изменяется на true. Где обрабатывается исключение?
Я использую глобальный фильтр действий для обработки и регистрации всех исключений.
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new ElmahHandleErrorAttribute());
filters.Add(new HandleErrorAttribute());
}
Это как глобальный фильтр действийElmahHandleErrorAttribute
определяется - он переопределяетOnException
метод.
public class ElmahHandleErrorAttribute : System.Web.Mvc.HandleErrorAttribute
{
public override void OnException(ExceptionContext context)
{
//Is the exception handled already? context.ExceptionHandled seems to be true here
if (!context.IsChildAction && (context.HttpContext.IsCustomErrorEnabled))
{
//Do other stuff stuff
//Log to Elmah
}
}
...
}
Я не понимаю, почему ценностьcontext.ExceptionHandled
верно, когдаOnException
метод выполняется.
Как обрабатывается это исключение?
-EDIT-
у меня естьcustomErrors
раздел вWeb.Config
, у меня естьErrorController
класс и действия под названиемGeneral
а такжеHttp404
.
<customErrors mode ="On" defaultRedirect="Error/General">
<error statusCode="404" redirect="Error/Http404"/>
</customErrors>
What I don't understand is, the controller action General
is not executed (breakpoint is never hit), but the value of ExceptionContext.ExceptionHandled
is set to true when the OnException
method of ElmahHandleErrorAttribute
starts executing.