cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <nickl...@planet.nl>
Subject [2.1] Handling errors in sub sitemap
Date Thu, 03 Apr 2008 13:56:09 GMT
I've tried following the explanation on handling errors with cocoon [1], but I can't get it
working like I expect.

I've a main sitemap in which sits a pipeline:

            <map:match pattern="external/**">
                <map:mount src="site://external/sitemap.xmap" uri-prefix="external" />
            </map:match>

And I have a external/sitemap.xmap which contains:

            <map:match pattern="data">
                <map:generate src="repository:default://data/messages.xml" />
                <map:transform src="site://transformers/external/data.xsl" />
                <map:serialize type="xml" />
            </map:match>

This site map can throw a java.net.MalformedURLException inside a ProcessingException. So
I've created a selector:
    <map:components>
        <map:selectors>
            <map:selector name="exception" src="org.apache.cocoon.selection.ExceptionSelector">
                <exception name="processing" class="org.apache.cocoon.ProcessingException"
unroll="true" />
                <exceptions name="malformedurl" class="java.net.MalformedURLException"
/>
            </map:selector>
        </map:selectors>
    </map:components>

I tried putting the selector inside the subsitemap and created a handle-errors:
            <map:handle-errors>
                <map:select type="exception">
                    <map:when test="processing">
                        <map:generate src="resource://processing.xml" />
                        <map:serialize type="xml" />
                    </map:when>
                    <map:when test="malformedurl">
                        <map:generate src="resource://malformedurl.xml" />
                        <map:serialize type="xml" />
                    </map:when>
                </map:select>
            </map:handle-errors>

This piece I tried putting inside the <pipeline> that contains the data matcher and
inside the <pipelines> element that contains the data matcher. This two options didn't
work. Then I tried putting the selector and the handle errors in the <pipelines> element
which contains my mount part. And there it only handled the ProcessingException part and not
the malformed url part.

I'm using Cocoon 2.1.11.

Can errors be handled in the sitemap where they are generated, even though the sitemap is
mounted?
Why is my processingexception not being unrolled?

Hope someone can help,

Nick S.

[1] http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html

Mime
View raw message