public interface ExceptionHandlerAware
The main pipeline consists of multiple sub-pipelines:
In the event that both of the pipelines are empty, the default behavior is to rethrow the initial exception.
There is no need to implement the methods unless you override the default behavior.
Modifier and Type | Method and Description |
---|---|
default void |
addHandler(ExceptionHandler handler)
Add a handler to the default pipeline.
|
default void |
addHandler(ExceptionHandler handler,
java.lang.Class<? extends java.lang.Exception> clazz)
Add a handler to an exception specific pipeline.
|
java.util.Map<java.lang.Class<? extends java.lang.Exception>,java.util.List<ExceptionHandler>> |
getExceptionHandlers() |
default java.lang.Exception |
handle(java.lang.Exception e)
Execute the pipeline by starting with the specific pipeline for the exception
followed by the default pipeline.
|
default void |
removeHandler(ExceptionHandler handler)
Remove a handler from the default pipeline.
|
default void |
removeHandler(ExceptionHandler handler,
java.lang.Class<? extends java.lang.Exception> clazz)
Remove a handler from an exception specific handler pipeline.
|
default void |
removeHandlers(java.lang.Class<? extends java.lang.Exception> clazz)
Remove all handler for a specific exception handling pipeline.
|
java.util.Map<java.lang.Class<? extends java.lang.Exception>,java.util.List<ExceptionHandler>> getExceptionHandlers()
default void addHandler(ExceptionHandler handler)
handler
- ExceptionHandler to add.default void addHandler(ExceptionHandler handler, java.lang.Class<? extends java.lang.Exception> clazz)
handler
- ExceptionHandler to add.clazz
- Exception handler pipeline to add it to.default void removeHandler(ExceptionHandler handler)
handler
- ExceptionHandler to remove.default void removeHandler(ExceptionHandler handler, java.lang.Class<? extends java.lang.Exception> clazz)
handler
- ExceptionHandler to remove.clazz
- Exception pipeline to remove it from.default void removeHandlers(java.lang.Class<? extends java.lang.Exception> clazz)
clazz
- Exception pipeline to remove.default java.lang.Exception handle(java.lang.Exception e) throws java.lang.Exception
e
- Initial exception.java.lang.Exception
- In the event of a handler throwing an exception. Processing by further handlers would be cancelled.