Example #1
0
        public override void OnException(ExceptionContext context)
        {
            var logger = CoreProviderContext.GetLogger(context.RouteData.Values["controller"].ToString());

            logger.LogError(context.Exception.Message);

            base.OnException(context);

            if (!CoreProviderContext.HostingEnvironment.IsDevelopment())
            {
                context.ExceptionHandled = true;
                context.HttpContext.Response.StatusCode = 200;
                context.Result = new ContentResult {
                    Content = new AjaxResult {
                        state = ResultType.error.ToString(), message = context.Exception.Message
                    }.ToJson()
                };
            }
        }
Example #2
0
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     _Logger = CoreProviderContext.GetLogger(this.ControllerContext.ActionDescriptor.ControllerTypeInfo.Name);
     base.OnActionExecuting(context);
 }