This is not necessary, ASP.NET haves exception handling by itself. You only have to throw a exception. The view will catch it automatically when running on 'release' mode
Just add the 'FilterConfig' in your App_start
public class FilterConfig
{
/// <summary>
/// The register global filters.
/// </summary>
/// <param name="filters">
/// The filters.
/// </param>
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}