Nice thought, feel free to give a try - I'd use the
observer/observable pattern for this

best,
-Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi


On Sun, Jun 16, 2013 at 11:21 AM, Benedikt Ritter <benerit...@gmail.com> wrote:
> 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: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to