You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Kjeldahl Nilsson <tn...@marcello.no> on 2004/08/03 14:50:22 UTC

Passing a pipeline exception\error to an error handler function?

Hello all,

I'm writing some cocoon error handling for my project, and I'm a little 
stumped here. I've got a single error handle now, looking like this:

<map:handle-errors>
    <map:generate src="documents/html/cocoon_error.html"/>
    <map:serialize/>
</map:handle-errors>

What I'd like to do is call a flowscript function called "errorFlow"
which does some logging and other misc. logic before sending a 
jxtemplate page with the final, prettily formatted and translated error 
message. I need to pass the original exception object to this flowscript 
in order to do this. In other words I'd like something like this:

<map:handle-errors>
    <map:call function="errorFlow">
        <map:parameter name="exceptionObject" value="[exceptionObject]"/>
    </map:call>
</map:handle-errors>

So the million dollar question is: How do I get and pass the original 
exception object to the flowscript?


Thomas Kjeldahl Nilsson
Oslo, Norway

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Passing a pipeline exception\error to an error handler function?

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-08-03 at 16:15, Thomas Kjeldahl Nilsson wrote:
> > 
> > The exception (throwable) object is available in the objectModel, and
> > can be retrieved from it using ObjectModelHelper.getThrowable(). I don't
> > think there's a proper way to access this from flowscript, though there
> > are a variety of workarounds.
> > 
> 
> Hmm, isn't the whole object model accessible from the flowscripts?

This would suprise me.

> If not, do you have any particular suggestions\hints for workarounds?

I'm not sure what the easiest would be. One possible way is to make an
action that puts the throwable object in a request attribute.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Passing a pipeline exception\error to an error handler function?

Posted by Thomas Kjeldahl Nilsson <tn...@marcello.no>.

> 
> The exception (throwable) object is available in the objectModel, and
> can be retrieved from it using ObjectModelHelper.getThrowable(). I don't
> think there's a proper way to access this from flowscript, though there
> are a variety of workarounds.
> 

Hmm, isn't the whole object model accessible from the flowscripts?
If not, do you have any particular suggestions\hints for workarounds?


regards,
Thomas Kjeldahl Nilsson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Passing a pipeline exception\error to an error handler function?

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-08-03 at 14:50, Thomas Kjeldahl Nilsson wrote:
> Hello all,
> 
> I'm writing some cocoon error handling for my project, and I'm a little 
> stumped here. I've got a single error handle now, looking like this:
> 
> <map:handle-errors>
>     <map:generate src="documents/html/cocoon_error.html"/>
>     <map:serialize/>
> </map:handle-errors>
> 
> What I'd like to do is call a flowscript function called "errorFlow"
> which does some logging and other misc. logic before sending a 
> jxtemplate page with the final, prettily formatted and translated error 
> message. I need to pass the original exception object to this flowscript 
> in order to do this. In other words I'd like something like this:
> 
> <map:handle-errors>
>     <map:call function="errorFlow">
>         <map:parameter name="exceptionObject" value="[exceptionObject]"/>
>     </map:call>
> </map:handle-errors>
> 
> So the million dollar question is: How do I get and pass the original 
> exception object to the flowscript?

Using map:parameter you can only supply string values, so that wouldn't
work.

The exception (throwable) object is available in the objectModel, and
can be retrieved from it using ObjectModelHelper.getThrowable(). I don't
think there's a proper way to access this from flowscript, though there
are a variety of workarounds.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org