private HttpExceptionResponseInfo GetValue(Type type) { if (!_exceptionInfo.TryGetValue(type, out HttpExceptionResponseInfo info)) { info = new HttpExceptionResponseInfo(HttpStatusCode.InternalServerError, null); } return(info); }
public override void OnException(ExceptionContext context) { Exception ex = context.Exception; HttpExceptionResponseInfo info = Converter.GetMessageAndHttpCode(ex); context.HttpContext.Response.StatusCode = (int)info.Status; if (info.Message != null) { context.Result = new JsonResult(info.Message); } }