I've uploaded the patch into the following Jira ticket:
https://issues.apache.org/jira/browse/CHAIN-67

Please have a look and tell me what you think.

Thanks,
-Elijah

On Sun, Mar 4, 2012 at 5:18 AM, Simone Tripodi <simonetrip...@apache.org> wrote:
> I agree with your thoughts Elijah, when an exception is thrown nothing
> can be done in the chain to rescue the error.
> looking forward next patch!
> best,
> -Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Sun, Mar 4, 2012 at 7:39 AM, James Carman <ja...@carmanconsulting.com> 
> wrote:
>> I hate checked exceptions.  +1
>>
>> On Sat, Mar 3, 2012 at 11:07 PM, Elijah Zupancic <eli...@zupancic.name> 
>> wrote:
>>> As I've been working on the examples and the documentation for v2 of
>>> chain, I've noticed that the API for exception handling of Command and
>>> Chain is clunky.
>>>
>>> When executing a command like:
>>>
>>>        ProfileContext context = new ProfileContext();
>>>        Command<String, Object, ProfileContext> command = new ProfileCheck();
>>>
>>>        try {
>>>            command.execute(context);
>>>        }
>>>        catch (Exception e) {
>>>            throw new RuntimeException(e);
>>>        }
>>>
>>> The user of chain has to explicitly catch Exception. If the desire was
>>> to catch the most base error and force the user to deal with it, why
>>> aren't we using Throwable? Anyways, this design leads to less than
>>> elegant code and since we will be breaking the API in v2, I would like
>>> to suggest a different approach.
>>>
>>> I suggest that Command and Chain should throw a custom exception class
>>> called ChainException that inherits from RuntimeException. And in the
>>> CommandBase, ChainBase we wrap the catch of Exception in this runtime
>>> exception. Moreover, we would attach to ChainException some optional
>>> debug information about the Context invoked when the exception was
>>> encountered. If anyone thinks that this is a good idea, I can whip up
>>> a patch quickly.
>>>
>>> Thanks,
>>> -Elijah
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
> ---------------------------------------------------------------------
> 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