You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel M Garland <da...@titanemail.com> on 2006/04/06 16:50:56 UTC
Catching 'does not contain a component' exceptions
Hi all,
How do I handle 'page X does not contain a component' exceptions; I get
about 5 a day in my web app - they happen on a variety of pages and on a
variety of components. I presume that its caused by people manually
messing around with tapestry's URLs. Is there some engine method I can
override to catch this and say direct people to the homepage?
--
Dan Garland
------------------------
daniel.garland@titanemail.com
office: +44 (0) 207 803 1947
mob: +44 (0) 7979 770053
icq: 120963437
aim: dmgarland1767
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Catching 'does not contain a component' exceptions
Posted by Bryan Lewis <br...@maine.rr.com>.
Yes, it's possible. I'm still doing it the old Tapestry3 way...
overriding Engine.activateExceptionPage(). The guts of the code:
protected void activateExceptionPage(IRequestCycle cycle, Throwable
cause) {
ExceptionDescription[] edArray = new
ExceptionAnalyzer().analyze(cause);
ExceptionDescription ed = edArray[0];
String message = ed.getMessage();
if (message != null && message.indexOf("does not contain a
component") != -1) {
// write something to the log here
cycle.activate("UnexpectedError"); // page of your choice
renderResponse(cycle);
// Don't fall through to the usual error handler
return;
}
// ... the usual error handler...
}
In Tapestry4, though, I should probably be getting away from a custom
Engine. Custom error handlers can be configured as ExceptionPresenter
contributions.
Daniel M Garland wrote:
> Hi all,
>
> How do I handle 'page X does not contain a component' exceptions; I
> get about 5 a day in my web app - they happen on a variety of pages
> and on a variety of components. I presume that its caused by people
> manually messing around with tapestry's URLs. Is there some engine
> method I can override to catch this and say direct people to the
> homepage?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org