Handling Errors

Paloose error handling is similar to Cocoon but differs in some key areas. Like Cocoon each pipeline may define its own error handling.

Cocoon's error handler uses a specialized pipeline having a pre-configured generator, whereas Paloose's error handler uses a completely standard pipeline.

In Cocoon you do not define a generator inside the error handler. In Paloose you do. Error handlers are also (like Cocoon) hierarchical. Each error handler is bound to a particular pipeline. If an error occurs in a pipeline the error handler for that is invoked. If there is no handler then the previous (via mount) pipeline is offered the error. If this cannot then its previous pipeline is tried, and so on. If there are no appropriate handler then the error handler of the <map:pipelines> element in the root sitemap is tried. If that fails then the internal Paloose error mechanism takes over — but the user has no control of this.

<map:pipelines> <map:pipeline> ... Matchers ... </map:pipeline> <map:handle-errors> <map:generate src="context://content/error.xml"/> <map:transform src="context://resources/transforms/error2html.xsl"/> <map:serialize/> </map:handle-errors> </map:pipelines>


The Paloose site uses a simple single point error handler in the root sitemap:

<map:pipelines> <map:pipeline> ... <!-- All html requests go to a subsite map for content --> <map:match pattern="**.html"> <map:mount src="content/sitemap.xmap"/> </map:match> ... <map:handle-errors> <map:generate type="px" src="context://content/error.xml"/> <map:transform src="context://resources/transforms/page2html.xsl" label="page-transform"> <map:parameter name="page" value="error"/> </map:transform> <map:serialize type="xhtml"/> </map:handle-errors> </map:pipeline> </map:pipelines>

The error page (or at least the content part) has a simple header and single paragraph. The part to notice here is the use of the embedded sitemap variable, {error:message}, which contains the message associated with the error.

<page:content> <t:heading level="1">Oops! an error occurred, please select a new page ...</t:heading> <t:p label="normalPara">{error:message}</t:p> </page:content>

To see how this works try the following error URL.

Copyright 2006 – 2023 Hugh Field-Richards. All Rights Reserved.