You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by manuel aldana <al...@gmx.de> on 2009/02/09 22:16:41 UTC
Looking for 'magic RuntimeException wrapper' after component throws
checked Exception
Hi,
when a custom component throws a checked Exception it seems to be
handled by a kind of Interceptor, but I cannot find it while debugging
or looking at source code. I am sure there is some higher exception
wrapping magic involved here (though I haven't found any Interceptor or
AOP style wrapping)...
This checked exception gets intercepted:
-----
class Comp{
@BeginRender
void renderMessage(MarkupWriter writer) throws Exception{
throw new CheckedException();
}
}
----
This unchecked exception does not get intercepted:
----
class Comp{
@BeginRender
void renderMessage(MarkupWriter writer) {
throw new UncheckedException();
}
}
----
thanks.
--
manuel aldana
aldana@gmx.de
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Looking for 'magic RuntimeException wrapper' after component throws
checked Exception
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
it would we nice to be able to add an exception handler for such an
exception
... onExceptionFromCheckedException(Exception e)
checked exceptions are always related to the business domain and usually
always
need to be refelected in the user interface in an apropriate way
see also https://issues.apache.org/jira/browse/TAP5-44
:)
g,
kris
Howard Lewis Ship <hl...@gmail.com>
10.02.2009 02:13
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>
An
Tapestry users <us...@tapestry.apache.org>
Kopie
Thema
Re: Looking for 'magic RuntimeException wrapper' after component throws
checked Exception
The question is: what should you do with thrown exceptions from such a
method?
I wonder if we could go further down the meta-programming path, by
introducing a method annotation to clue Tapestry in to what to do in
case of a thrown exception in the method ... and that could be
implemented as method advice provided by yet another
ComponentClassTransformWorker. They're like potatoe chips! (Bet ya
can't each just one!)
On Mon, Feb 9, 2009 at 3:42 PM, manuel aldana <al...@gmx.de> wrote:
> Thanks, I guess I found it:
>
> RenderPhaseMethodWorker.java line 147:
> builder.addln("catch (RuntimeException ex) { throw ex; }");
> builder.addln("catch (Exception ex) { throw new RuntimeException(ex);
}");
>
> btw: all this dynamic magic is really nice from runtime-view but also
really
> tough to debug :)
>
>
> Ulrich Stärk schrieb:
>>
>> This probably happens during class transformation. I'd look somewhere
in
>> the o.a.t.transform packages.
>>
>> Uli
>>
>> manuel aldana schrieb:
>>>
>>> Hi,
>>>
>>> when a custom component throws a checked Exception it seems to be
handled
>>> by a kind of Interceptor, but I cannot find it while debugging or
looking at
>>> source code. I am sure there is some higher exception wrapping magic
>>> involved here (though I haven't found any Interceptor or AOP style
>>> wrapping)...
>>>
>>> This checked exception gets intercepted:
>>> -----
>>> class Comp{
>>> @BeginRender
>>> void renderMessage(MarkupWriter writer) throws Exception{
>>> throw new CheckedException();
>>> }
>>> }
>>> ----
>>>
>>>
>>> This unchecked exception does not get intercepted:
>>> ----
>>> class Comp{
>>> @BeginRender
>>> void renderMessage(MarkupWriter writer) {
>>> throw new UncheckedException();
>>> }
>>> }
>>> ----
>>>
>>> thanks.
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> --
> manuel aldana
> aldana@gmx.de
> software-engineering blog: http://www.aldana-online.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Looking for 'magic RuntimeException wrapper' after component
throws checked Exception
Posted by Howard Lewis Ship <hl...@gmail.com>.
The question is: what should you do with thrown exceptions from such a method?
I wonder if we could go further down the meta-programming path, by
introducing a method annotation to clue Tapestry in to what to do in
case of a thrown exception in the method ... and that could be
implemented as method advice provided by yet another
ComponentClassTransformWorker. They're like potatoe chips! (Bet ya
can't each just one!)
On Mon, Feb 9, 2009 at 3:42 PM, manuel aldana <al...@gmx.de> wrote:
> Thanks, I guess I found it:
>
> RenderPhaseMethodWorker.java line 147:
> builder.addln("catch (RuntimeException ex) { throw ex; }");
> builder.addln("catch (Exception ex) { throw new RuntimeException(ex); }");
>
> btw: all this dynamic magic is really nice from runtime-view but also really
> tough to debug :)
>
>
> Ulrich Stärk schrieb:
>>
>> This probably happens during class transformation. I'd look somewhere in
>> the o.a.t.transform packages.
>>
>> Uli
>>
>> manuel aldana schrieb:
>>>
>>> Hi,
>>>
>>> when a custom component throws a checked Exception it seems to be handled
>>> by a kind of Interceptor, but I cannot find it while debugging or looking at
>>> source code. I am sure there is some higher exception wrapping magic
>>> involved here (though I haven't found any Interceptor or AOP style
>>> wrapping)...
>>>
>>> This checked exception gets intercepted:
>>> -----
>>> class Comp{
>>> @BeginRender
>>> void renderMessage(MarkupWriter writer) throws Exception{
>>> throw new CheckedException();
>>> }
>>> }
>>> ----
>>>
>>>
>>> This unchecked exception does not get intercepted:
>>> ----
>>> class Comp{
>>> @BeginRender
>>> void renderMessage(MarkupWriter writer) {
>>> throw new UncheckedException();
>>> }
>>> }
>>> ----
>>>
>>> thanks.
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> --
> manuel aldana
> aldana@gmx.de
> software-engineering blog: http://www.aldana-online.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Looking for 'magic RuntimeException wrapper' after component
throws checked Exception
Posted by manuel aldana <al...@gmx.de>.
Thanks, I guess I found it:
RenderPhaseMethodWorker.java line 147:
builder.addln("catch (RuntimeException ex) { throw ex; }");
builder.addln("catch (Exception ex) { throw new RuntimeException(ex); }");
btw: all this dynamic magic is really nice from runtime-view but also
really tough to debug :)
Ulrich Stärk schrieb:
> This probably happens during class transformation. I'd look somewhere
> in the o.a.t.transform packages.
>
> Uli
>
> manuel aldana schrieb:
>> Hi,
>>
>> when a custom component throws a checked Exception it seems to be
>> handled by a kind of Interceptor, but I cannot find it while
>> debugging or looking at source code. I am sure there is some higher
>> exception wrapping magic involved here (though I haven't found any
>> Interceptor or AOP style wrapping)...
>>
>> This checked exception gets intercepted:
>> -----
>> class Comp{
>> @BeginRender
>> void renderMessage(MarkupWriter writer) throws Exception{
>> throw new CheckedException();
>> }
>> }
>> ----
>>
>>
>> This unchecked exception does not get intercepted:
>> ----
>> class Comp{
>> @BeginRender
>> void renderMessage(MarkupWriter writer) {
>> throw new UncheckedException();
>> }
>> }
>> ----
>>
>> thanks.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
--
manuel aldana
aldana@gmx.de
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Looking for 'magic RuntimeException wrapper' after component
throws checked Exception
Posted by Howard Lewis Ship <hl...@gmail.com>.
Yes, the generated code catches the thrown exception and wraps it.
On Mon, Feb 9, 2009 at 1:24 PM, Ulrich Stärk <ul...@spielviel.de> wrote:
> This probably happens during class transformation. I'd look somewhere in the
> o.a.t.transform packages.
>
> Uli
>
> manuel aldana schrieb:
>>
>> Hi,
>>
>> when a custom component throws a checked Exception it seems to be handled
>> by a kind of Interceptor, but I cannot find it while debugging or looking at
>> source code. I am sure there is some higher exception wrapping magic
>> involved here (though I haven't found any Interceptor or AOP style
>> wrapping)...
>>
>> This checked exception gets intercepted:
>> -----
>> class Comp{
>> @BeginRender
>> void renderMessage(MarkupWriter writer) throws Exception{
>> throw new CheckedException();
>> }
>> }
>> ----
>>
>>
>> This unchecked exception does not get intercepted:
>> ----
>> class Comp{
>> @BeginRender
>> void renderMessage(MarkupWriter writer) {
>> throw new UncheckedException();
>> }
>> }
>> ----
>>
>> thanks.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Looking for 'magic RuntimeException wrapper' after component
throws checked Exception
Posted by Ulrich Stärk <ul...@spielviel.de>.
This probably happens during class transformation. I'd look somewhere in the o.a.t.transform packages.
Uli
manuel aldana schrieb:
> Hi,
>
> when a custom component throws a checked Exception it seems to be
> handled by a kind of Interceptor, but I cannot find it while debugging
> or looking at source code. I am sure there is some higher exception
> wrapping magic involved here (though I haven't found any Interceptor or
> AOP style wrapping)...
>
> This checked exception gets intercepted:
> -----
> class Comp{
> @BeginRender
> void renderMessage(MarkupWriter writer) throws Exception{
> throw new CheckedException();
> }
> }
> ----
>
>
> This unchecked exception does not get intercepted:
> ----
> class Comp{
> @BeginRender
> void renderMessage(MarkupWriter writer) {
> throw new UncheckedException();
> }
> }
> ----
>
> thanks.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org