cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Flow and map:handle-errors
Date Wed, 10 Sep 2003 15:39:21 GMT
Timothy Larson wrote:

>--- Sylvain Wallez <> wrote:
>>Error-handlers are not invoked on internal requests, which is what the 
>>flow uses behind sendPage[AndWait](). In that case, the exception are 
>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.

That's because processing of the page occurs outside of the scope of the 
flowscript. There's no way to catch this in the flow.

>>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 
>>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.

Yep. We cannot for two reasons :
- we cannot catch exceptions after an internal redirect (in e.g. an 
action) because the redirection is handled when going back in the 
sitemap engine from the component having done the redirect,
- we cannot because sendPageAndWait() creates a continuation that halts 
execution of the flow script.

>>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.

Yep. But you can't get your first wish...

I would say that 1/ is required as it can be considered as a bug. For 2/ 
this is a new feature that has to be discussed.


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

View raw message