Daniel Schmidt wrote: > Hi David, > > > Just in case you have not seen it, and to add more connections info to the > > mail archives: > > http://wiki.apache.org/cocoon/ErrorHandling > > Some of that is old, but there is a good thread linked in the section about > > Cocoon 2.1 that is relevant: > > Subject: Generators now allowed in <map:handle-errors> > > http://marc.info/?l=xml-cocoon-dev&m=104923290631009 > > Thank you very much for the links provided. > > I was able to make it work.
Great. And thanks for sharing your solution. I now have my project working nicely too, and also enhanced Apache Forrest to enable per-project configuration of Cocoon error handling: http://forrest.apache.org/faq.html#handle-errors thanks -David > Here is the code for throwing individual exceptions from within XSLT to the > cocoon sitemap: > > ... > <map:selectors> > <map:selector name="exception" > src="org.apache.cocoon.selection.XPathExceptionSelector"> > <exception name="FileNotFound" > class="org.apache.cocoon.ResourceNotFoundException"/> > <exception name="Transform" > class="javax.xml.transform.TransformerException" unroll="true"> > <xpath name="ContentNotAvailableInCountry" > test="message='ContentNotAvailableInCountry'"/> > </exception> > <exception class="java.lang.Throwable" unroll="true"/> > </map:selector> > </map:selectors> > ... > <map:handle-errors> > <map:select type="exception"> > <map:when test="ContentNotAvailableInCountry"> > <!-- defined <xsl:message > terminate="yes">ContentNotAvailableInCountry</xsl:message> error --> > </map:when> > <map:when test="Transform"> > <!-- generic <xsl:message terminate="yes"/> error --> > </map:when> > <map:when test="FileNotFound"> > <!-- file not found error --> > </map:when> > <map:otherwise> > <!-- something else --> > </map:otherwise> > </map:select> > </map:handle-errors> > ... > > This works for me. The key is to have the unroll="true" in it + the order of > the <exceptions/>. > > I will do further testing. > > Cheers, > Daniel --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org