What is the best way to handle multiple IExceptionHandler implementations in WebAPI?
config.Services.Replace(typeof(IExceptionHandler), new ExceptionHandlerFilter()); config.Services.Add(typeof(IExceptionHandler), new ValidationExceptionHandlerFilter());
When trying to register more than 1 implementation, the launch throws an exception:
IExceptionHandler service type is not supported. \ R \ nParameter: serviceType
But the API offers several handlers, since the ShouldHandle property ShouldHandle for overriding in the ExceptionHandler class.
source share