In ASP.NET MVC, why don't I stick a HandleError on the underlying controller and do about it?
Since HandleError is inherited by derived controllers, why not just create (or have) a base controller and apply a HandleError on it so that any controllers that inherit from the base controller are automatically handled as well?
And then I would stop at overriding HandleError on controllers and individual actions.
Can anyone think of any reason why I don't want to apply a HandleError to the underlying controller?
+2
a source to share
2 answers
To me a HandleError on a base controller looks like your whole application with a try {} catch {} block. You have essentially stopped handling exceptions like exceptions that made them commonplace in your application.
You could only "catch" what you know can happen, not everything that can happen.
-1
a source to share