using NFine.Code; using System.Text; using System.Web.Mvc; namespace NFine.Web { public class HandlerErrorAttribute : HandleErrorAttribute { public override void OnException(ExceptionContext context) { base.OnException(context); context.ExceptionHandled = true; context.HttpContext.Response.StatusCode = 200; context.Result = new ContentResult { Content = new AjaxResult { state = ResultType.error.ToString(), message = context.Exception.Message }.ToJson() }; //StringBuilder sbScript = new StringBuilder(); //sbScript.Append(""); //context.Result = new ContentResult() { Content = sbScript.ToString() }; } private void WriteLog(ExceptionContext context) { if (context == null) return; var log = LogFactory.GetLogger(context.Controller.ToString()); log.Error(context.Exception); } } }