Apache » Cocoon »

  Cocoon Core

Cocoon Core 2.2



In a <map:handle-errors>, selects depending on the exception that caused the error. The configuration of this selector allows to map exception class names to symbolic names that are used in the <map:when> alternatives.

Basic information

Component typeSelector
Cocoon blockcore
Java classorg.apache.cocoon.selection.ExceptionSelector
Name in Sitemap


Example configuration :

<map:selector type="error" src="....ExceptionSelector">
  <exception class="org.xml.sax.SAXException" name="sax" unroll="true"/>
  <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/>
  <exception class="org.apache.cocoon.ProcessingException" unroll="true"/>
  <exception name="denied" class="java.security.SecurityException"/>
  <exception name="denied" class="my.comp.auth.AuthenticationFailure"/>

This example shows several features :

  • the "class" is the class name of the exception (which can be any <code>Throwable</code>),
  • an exception can be given a name, which is used in the &lt;map:when> tests,
  • an exception can be unrolled, meaning we try to get its cause and then consider this cause for the exception name
Note that both "name" and "unroll" can be specified. In that case, we first try to unroll the exception,
and if none of the causes has a name, then the "name" attribute is considered.