Reputation: 2856
Trying to understand the MVC pipeline here:
It seems that the order is like so:
When does the Controller.OnException run relative to the ExceptionFilterAttribute.OnException?
Upvotes: 4
Views: 380
Reputation: 273244
It's probably documented somewhere, in the source at least, but I just ran this little experiment:
// in MyHandleErrorAttribute, globally configured
public override void OnException(ExceptionContext filterContext)
{
Debug.Print("HandleErrorAttribute.OnException 1");
base.OnException(filterContext);
Debug.Print("HandleErrorAttribute.OnException 2");
}
...
// in HomeController
protected override void OnException(ExceptionContext filterContext)
{
Debug.Print("Controller OnException 1");
base.OnException(filterContext);
Debug.Print("Controller OnException 2");
}
and the Output Window shows:
HandleErrorAttribute.OnException 1
HandleErrorAttribute.OnException 2
Controller OnException 1
Controller OnException 2
Upvotes: 3