private static void CreateResultObject(ExceptionContext context, ExceptionProblemJson response) { context.Result = new ObjectResult(response) { StatusCode = response.StatusCode, DeclaredType = response.GetType() }; }
private void HandleHypermediaException(ExceptionContext context) { var response = new ExceptionProblemJson(context.Exception) { Title = "Hypermedia error.", ProblemType = "WebApiHypermediaExtensionsCore.HyperrmediaError", StatusCode = (int)HttpStatusCode.InternalServerError }; CreateResultObject(context, response); }
private static void GenericResponse(ExceptionContext context) { var response = new ExceptionProblemJson(context.Exception) { Title = "Sorry, something went wrong.", ProblemType = "WebApiHypermediaExtensionsCore.InternalError", StatusCode = (int)HttpStatusCode.InternalServerError }; CreateResultObject(context, response); }
private void HandleUnauthorizedAccessException(ExceptionContext context) { var response = new ExceptionProblemJson(context.Exception) { Title = "Not authorized.", ProblemType = "WebApiHypermediaExtensionsCore.NotAuthorized", StatusCode = (int)HttpStatusCode.Unauthorized }; CreateResultObject(context, response); }