You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lionel Crine <cr...@4dconcept.fr> on 2003/07/16 18:12:53 UTC

[A SOLUTION] Speicifed the error for the map:handle-error

I found something working, but I think this is not clean!

For any Exception I throw a processingException.
Then the <map:handle-errors> gets it.

lionel



At 16:03 16/07/2003 +0200, you wrote:
>Hi,
>
>I'd the <map:handle-error> to handle my custom exception (not only the 404 
>and 500).
>Where can i do that ?
>Is there something to overload?
>
>I read some post on the mailing, and wiki but nothing helps ?
>
>Lionel
>
>Lionel CRINE
>Société : 4DConcept
>22 rue Etienne de Jouy 78353 JOUY EN JOSAS
>Tel : 01.34.58.70.70 Fax : 01.39.58.70.70
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: [A SOLUTION] Speicifed the error for the map:handle-error

Posted by Lionel Crine <cr...@4dconcept.fr>.
Thanks, it's really fine.



At 12:10 16/07/2003 -0500, you wrote:
>Lionel Crine wrote:
>>I found something working, but I think this is not clean!
>>For any Exception I throw a processingException.
>>Then the <map:handle-errors> gets it.
>>lionel
>>
>>At 16:03 16/07/2003 +0200, you wrote:
>>
>>>Hi,
>>>
>>>I'd the <map:handle-error> to handle my custom exception (not only the 
>>>404 and 500).
>>>Where can i do that ?
>>>Is there something to overload?
>>>
>>>I read some post on the mailing, and wiki but nothing helps ?
>
>Lionel,
>
>You can do this in your sitemap:
><map:components>
>         ...
>
>         <map:selector name="exception" 
> src="org.apache.cocoon.selection.XPathExceptionSelector">
>                 <exception name="my-exception" class="org.me.MyException"/>
>       </map:selector>
>         ...
></map:components>
>
>
>and then
>
>     <map:handle-errors>
>         <map:select type="exception">
>             <map:when test="my-exception">
>                 <map:generate src="foo.xml"/>
>                 <map:transform src="whatever.xsl"/>
>                 <map:serialize/>
>             </map:when>
>         </map:select>
>     </map:handle-errors>
>
>This seems to be fairly clean, IMO.
>
>
>Tony
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: [A SOLUTION] Speicifed the error for the map:handle-error

Posted by Tony Collen <co...@umn.edu>.
Lionel Crine wrote:
> I found something working, but I think this is not clean!
> 
> For any Exception I throw a processingException.
> Then the <map:handle-errors> gets it.
> 
> lionel
> 
> 
> 
> At 16:03 16/07/2003 +0200, you wrote:
> 
>> Hi,
>>
>> I'd the <map:handle-error> to handle my custom exception (not only the 
>> 404 and 500).
>> Where can i do that ?
>> Is there something to overload?
>>
>> I read some post on the mailing, and wiki but nothing helps ?

Lionel,

You can do this in your sitemap:
<map:components>
	...

	<map:selector name="exception" src="org.apache.cocoon.selection.XPathExceptionSelector">
         	<exception name="my-exception" class="org.me.MyException"/>
       </map:selector>
	...
</map:components>


and then

     <map:handle-errors>
         <map:select type="exception">
             <map:when test="my-exception">
                 <map:generate src="foo.xml"/>
                 <map:transform src="whatever.xsl"/>
                 <map:serialize/>
             </map:when>
         </map:select>
     </map:handle-errors>

This seems to be fairly clean, IMO.


Tony


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