Hi,
I'm thinking about adding an ExceptionHandler to Chain. It would look like the
following:
public interface ExceptionHandler<K, V, C extends Map<K, V>> {
/**
* Tries to handle the given exception that was thrown during chain
execution.
*
* @return true if the handler was able to handle {@code thrown}.
*/
boolean handle(Exception thrown, C context);
}
The execution of a chain would change like this:
- call the commands one after another.
- if an exception is thrown during execution hand it to the registered
ExceptionHandlers until one returns true.
- if a handler returns true, continue execution as if no exception has been
thrown.
- if no handler is able to handle the exception, proceed with the normal
exception handling (call postProcess() methods on filters, wrap exception into
a ChainException)
I'm not sure about how to register ExceptionHandlers. I was thinking about
adding:
void register(Exception ex, ExceptionHandler handler)
to chain. One handler could be registered for several Exceptions.
WDYT?
Benedikt
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]