public override void OnException(ExceptionContext context) { if (context.Exception.GetType() == typeof(InvalidOperationException)) { context.Result = Helpers.GetContentResult(context.Result, "Action Exception Filter"); } }
public void OnException(ExceptionContext expContext) { //Log exception if (expContext.Exception != null) { _Logger.LogError($"Error in {expContext.HttpContext.Request.Path}: {expContext.Exception.Message}"); } }
public void OnException(ExceptionContext context) { context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = new Error { LogRef = context.HttpContext.Request.Headers["X-Request-ID"], Message = "Internal Server Error" }; context.Result = new ObjectResult(error); }
public void OnException(ExceptionContext context) { var exception = context.Exception; if (exception is DomainException) { context.Result = new BadRequestObjectResult(context.Exception.Message); } else { context.Result = new BadRequestObjectResult(context.Exception); } }
public void OnException(ExceptionContext context) { var result = new ExceptionResult(); var exception = context.Exception; if (exception is ForbiddenException) { result.Message = exception.Message; } else if(exception is DomainException) { result.Message = exception.Message; } else { result.Message = exception.Message; result.Exception = exception; } context.Result = new BadRequestObjectResult(result); }
public override void OnException(ExceptionContext context) { }
public void OnException(ExceptionContext context) { }
public override void OnException(ExceptionContext context) { throw new InvalidProgramException("Exception Filter threw"); }
public override void OnException(ExceptionContext context) { context.Exception = null; }
public void OnException(ExceptionContext context) { context.Result = Helpers.GetContentResult(context.Result, "GlobalExceptionFilter.OnException"); }
#pragma warning restore 1998 public virtual void OnException([NotNull] ExceptionContext context) { }
#pragma warning disable 1998 public virtual async Task OnExceptionAsync([NotNull] ExceptionContext context) { OnException(context); }
public void OnException(ExceptionContext context) { var ex = context.Exception; }