You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andre Juffer <aj...@sun3.oulu.fi> on 2007/04/22 21:44:00 UTC
Catching exceptions in binding
Hi,
suppose I have the following:
<fb:javascript id="someId" path="." direction="save">
<fb:save-form>
....
object.setValues(values);
</fb:save-form>
</fb:javascript>
Suppose the 'object.setValues(values)' throws an exception for whatever
reason. With flow I have something like:
....
catch (exception)
{
form.lookupWidget("messages").addMessage(exception);
}
It seems that when an exception is thrown by 'object.setValues(values)', an
org.apache.avalon.framework.CascadingRuntimeException: Error invoking
JavaScript event handler
is thrown, instead of the actual exception that was in fact thrown by
the 'object.setValues(values)'.
What would be the best possible way to avoid the
CascadingRuntimeException and get the original exception with flow. I
have tried an try { ... } catch block, but I would like to avoid this.
(The alternative is of course to ensure that the values that go into the
'object.setValues(values);' do not cause any exception.)
Thanks for your help,
Andre.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Catching exceptions in binding
Posted by Jason Johnston <co...@lojjic.net>.
Andre Juffer wrote:
> Hi,
>
> suppose I have the following:
>
> <fb:javascript id="someId" path="." direction="save">
> <fb:save-form>
> ....
> object.setValues(values);
> </fb:save-form>
> </fb:javascript>
>
> Suppose the 'object.setValues(values)' throws an exception for whatever
> reason. With flow I have something like:
>
> ....
> catch (exception)
> {
> form.lookupWidget("messages").addMessage(exception);
> }
>
> It seems that when an exception is thrown by 'object.setValues(values)', an
>
> org.apache.avalon.framework.CascadingRuntimeException: Error invoking
> JavaScript event handler
>
> is thrown, instead of the actual exception that was in fact thrown by
> the 'object.setValues(values)'.
>
> What would be the best possible way to avoid the
> CascadingRuntimeException and get the original exception with flow.
Well, the CascadingRuntimeException most likely wraps the original
exception, which you can retrieve with e.getCause(). Does that meet
your needs?
> I
> have tried an try { ... } catch block, but I would like to avoid this.
> (The alternative is of course to ensure that the values that go into the
> 'object.setValues(values);' do not cause any exception.)
>
> Thanks for your help,
> Andre.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org