...
First, name your handler class with the convention {exceptionType}ResponseHandler. So if your exception class is CustomerException
your handler class would be named CustomerExceptionResponseHandler
. This is the default pattern AbstractExceptionRepsonseHandler
uses in its CanHandle
method. Second, register your handler as a named instance of IExceptionResponseHandler
through through the DI container. For example: TODO link to DI container docs here.
Code Block | ||
---|---|---|
| ||
public class Installer : ISecondaryUnityInstaller { public void Install(IUnityContainer container) { container.RegisterType<IExceptionResponseHandler, CustomerExceptionResponseHandler>(typeof(CustomerExceptionResponseHandler).FullName); } } |
...