After struggling with RegisterGlobalFilters and HandleErrorAttribute forever I decided to go back to the bare bones. I created a new MVC 3 project in VS10, using the template. Add a throw DivideByZeroException in the About-action and fired up the dev server. Expected not to see a yellow screen.
But I did.
Why won't this work for me?
Update
archil's and Adam Tuliper's suggestion kind of worked. The Error view was called.
Then I proceed to add this in RegisterGlobalFilters.
filters.Add(new HandleErrorAttribute { ExceptionType = typeof(DivideByZeroException), View = "DivideByZeroException", Order = 1 });
filters.Add(new HandleErrorAttribute { View = "AllOtherExceptions", Order = 2 });
The AllOtherExceptions view was called. Why not the DivideByZeroException view?
The followup question has been posted here.
HandleErrorAttribute works when following conditions are met
As in your case second condition is met, ensure you have custom erros turned on