There are a number of ways to deal with unhandled exceptions
in ASP.NET MVC. By default, nothing is handled and users are shown ugly error
stack traces. With a bit of effort, and using some of the same configuration
values that have always been available within ASP.NET, it is easy to set up
much friendlier error pages. If you need to be able to really customize the
way errors are handled, you can override the HandleError attribute, or you can
create a custom ViewResult that encapsulates the details of the exception and
specifies how they should be displayed.
You can download the code for this article here.