ChessSharp.Web.Controllers.ChessApiController.JsonErrorHandlerAttribute.OnException C# (CSharp) 메소드

OnException() 공개 메소드

public OnException ( System.Web.Mvc.ExceptionContext filterContext ) : void
filterContext System.Web.Mvc.ExceptionContext
리턴 void
            public void OnException(ExceptionContext filterContext)
            {
                filterContext.ExceptionHandled = true;
                filterContext.HttpContext.Response.StatusCode = 500;
                filterContext.Result = new JsonResult
                {
                    Data = new
                    {
                        success = false,
                        error =
                            filterContext.Exception.ToString(),
                        message = filterContext.Exception.Message
                    },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
            }
ChessApiController.JsonErrorHandlerAttribute