cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Larson <timlarsonw...@yahoo.com>
Subject Re: Flow and map:handle-errors
Date Wed, 10 Sep 2003 14:55:30 GMT
--- Sylvain Wallez <sylvain.wallez@anyware-tech.com> wrote:
> Error-handlers are not invoked on internal requests, which is what the 
> flow uses behind sendPage[AndWait](). In that case, the exception are 
> propagated.

How do you catch these exceptions in a flowscript?  I tried a simple
  try{sendPageAndWait(some-page-with-an-error)}
  catch(){sendPageAndWait(some-custom-error-page}
but the catch never caught an exception.  Instead I just got the standard
error page in the browser.

> Internal requests are created in 2 circumstances :
> - use of SitemapSource: SourceResolver.resolveURI("cocoon:/blah")
> - use of internal redirects: <map:redirect-to uri="cocoon:/blah"/> or 
> Redirector.redirect("cocoon:/blah")
> 
> The flow uses an internal redirect to handle an external request. This 
> means that the propagated exception is only catched by the top-level 
> Cocoon object which outputs the default error page (if configured to do 
> so). So we can say that the behaviour of not executing error handlers 
> for internal requests is not suitable for internal redirects.

Does this mean that we cannot catch the exception from the flowscript?
That would be bad.

> There are 2 solutions to solve this :
> 1/ apply the same policy for internal redirects than the one that was 
> active before the redirect (i.e. handle errors on internal redirects 
> resulting from external requests)
> 2/ let the user choose the behaviour through the a new attribute such as 
> handle-internal="true" on <handle-errors>.
>
> Thinking further, these 2 solutions are complementary if we consider 
> that 2/ applies only to internal requests produced by the SitemapSource.
> 
> What do you think ?

I personally would be happy if the flowscript could catch errors as
exceptions and create its own responses, such as sending an alternate page
or an error page.

It would be nice to also have the option of letting the sitemap handle-errors
pipeline take care of it, but I am not too worried about this if I can get my
first wish.  I guess this last part is asking for a way to make solution 1
optional, possibly per call to sendPage[AndWait](), but I am not sure since
my current use case gives me no hints.

--Tim Larson


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Mime
View raw message