Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected override void OnException(ExceptionContext filterContext)
- {
- var action = filterContext.RouteData.Values["action"].ToString();
- var type = filterContext.Controller.GetType();
- var httpMethod = filterContext.RequestContext.HttpContext.Request.HttpMethod;
- filterContext.ExceptionHandled = true;
- var returnType = GetReturnType(type, action, httpMethod);
- if (returnType == typeof(JsonResult))
- filterContext.Result = HandleJsonError(filterContext.Exception);
- else
- filterContext.Result = HandleError(filterContext.Exception);
- }
- {"OK":false,"ErrorMessage":"Error message to the user"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement