The solution is to add a custom filter. Here's how to do it:
public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => options.Filters.Add(new MyExceptionFilter())); }
Now the custom filter should be obtained from IExceptionFilter:
public class MyExceptionFilter : ActionFilterAttribute, IExceptionFilter { public void OnException(ExceptionContext context) { } }
Unfortunately, it does not detect exceptions during Startup.Configuration ()
source share