EnVisageOnline/Beta/Source/EnVisage/Code/EnVisageHandleErrorAttribut...

25 lines
820 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EnVisage.Controllers;
namespace EnVisage.Code
{
public class EnVisageHandleErrorAttribute : HandleErrorAttribute
{
public override void OnException(ExceptionContext filterContext)
{
base.OnException(filterContext);
// return if there is no context, controller or exception because no data for logging
if (filterContext == null || filterContext.Controller == null || filterContext.Exception == null)
return;
var controller = filterContext.Controller as BaseController;
if (controller != null)
{
controller.LogException(filterContext.Exception);
}
}
}
}