You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Cantrell <ca...@pobox.com> on 2005/08/15 19:33:15 UTC
Control over exception handling
I'd like to place a hook in Tapestry to know when a request fails, so
that I can:
(1) roll back my transaction,
(2) send an email to the administrator, and
(3) show a user-friendly error page.
I'd normally do this through my web.xml (servlet filter + error page
descriptor), but Tapestry swallows exceptions and doesn't pass them
to the container. Of course this makes sense in my dev environment --
I *want* the very helpful error reporting! -- but not in production.
And even in dev, I still want the rollback.
So what is the right point to hook in this custom error handling?
It seems that I can create an "Exception" page. That addresses (3),
but what about (1) and (2)? Do I make the Exception page class
implement PageAttachListener or PageBeginRenderListener and do
rollback & email there ... or is that just a hack?
What is the best-practice approach here?
Cheers,
Paul
_________________________________________________________________
"Verbing weirds language." -- Bill Watterson
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Control over exception handling
Posted by Paul Cantrell <ca...@pobox.com>.
Thanks, Howard, this is what I was looking for!
Is this a reasonable place to do rollback on error?
Is there a single hook I can add to catch *any* error (e.g. "on any
type of failure do X, then continue rendering the normal error
page")? Or do I have a add a contribution for each of those different
error pages: exception, stale link, etc.?
Cheers,
Paul
On Aug 15, 2005, at 12:52 PM, Howard Lewis Ship wrote:
> In Tapestry 4.0 theres a service you can override that controls
> exception reporting.
>
> http://jakarta.apache.org/tapestry/tapestry/hivedocs/service/
> tapestry.error.ExceptionPresenter.html
>
> You can see how this is integrated into the rest of the framework:
>
> http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/
> tapestry.error.html
>
> <property name="exceptionPresenter"
> object="service:ExceptionPresenter" />
>
> By contributing a like service to tapestry.InfrastructureOverrides you
> can get precise control over exceptions.
>
> On 8/15/05, Paul Cantrell <ca...@pobox.com> wrote:
>
>> I'd like to place a hook in Tapestry to know when a request fails, so
>> that I can:
>>
>> (1) roll back my transaction,
>> (2) send an email to the administrator, and
>> (3) show a user-friendly error page.
>>
>> I'd normally do this through my web.xml (servlet filter + error page
>> descriptor), but Tapestry swallows exceptions and doesn't pass them
>> to the container. Of course this makes sense in my dev environment --
>> I *want* the very helpful error reporting! -- but not in production.
>> And even in dev, I still want the rollback.
>>
>> So what is the right point to hook in this custom error handling?
>>
>> It seems that I can create an "Exception" page. That addresses (3),
>> but what about (1) and (2)? Do I make the Exception page class
>> implement PageAttachListener or PageBeginRenderListener and do
>> rollback & email there ... or is that just a hack?
>>
>> What is the best-practice approach here?
>>
>> Cheers,
>>
>> Paul
>>
>> _________________________________________________________________
>>
>> "Verbing weirds language." -- Bill Watterson
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-
>> help@jakarta.apache.org
>>
>>
>>
>
>
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work. http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
_________________________________________________________________
"Prediction is hard, especially of the future." -- Niels Bohr
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Control over exception handling
Posted by Howard Lewis Ship <hl...@gmail.com>.
In Tapestry 4.0 theres a service you can override that controls
exception reporting.
http://jakarta.apache.org/tapestry/tapestry/hivedocs/service/tapestry.error.ExceptionPresenter.html
You can see how this is integrated into the rest of the framework:
http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.error.html
<property name="exceptionPresenter" object="service:ExceptionPresenter" />
By contributing a like service to tapestry.InfrastructureOverrides you
can get precise control over exceptions.
On 8/15/05, Paul Cantrell <ca...@pobox.com> wrote:
> I'd like to place a hook in Tapestry to know when a request fails, so
> that I can:
>
> (1) roll back my transaction,
> (2) send an email to the administrator, and
> (3) show a user-friendly error page.
>
> I'd normally do this through my web.xml (servlet filter + error page
> descriptor), but Tapestry swallows exceptions and doesn't pass them
> to the container. Of course this makes sense in my dev environment --
> I *want* the very helpful error reporting! -- but not in production.
> And even in dev, I still want the rollback.
>
> So what is the right point to hook in this custom error handling?
>
> It seems that I can create an "Exception" page. That addresses (3),
> but what about (1) and (2)? Do I make the Exception page class
> implement PageAttachListener or PageBeginRenderListener and do
> rollback & email there ... or is that just a hack?
>
> What is the best-practice approach here?
>
> Cheers,
>
> Paul
>
> _________________________________________________________________
>
> "Verbing weirds language." -- Bill Watterson
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org