You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/05/16 10:00:03 UTC

[WIKI-UPDATE] ErrorHandling SandBox Fri May 16 10:00:03 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=ErrorHandling , version: 3 on Fri May 16 07:52:41 2003 by SergeColin

+ ! Error type and ResourceNotFound exception
+ 
+ There seems to be only two type of error notification (as explained in the thread [Beautify 404|http://archives.real-time.com/pipermail/cocoon-devel/2001-July/010015.html]) :\\
+ 
+ * Type __500__: every exceptions except {{ResourceNotFound}} and {{ConnectionReset}} (special status)
+ 
+ * Type __404__: {{ResourceNotFound}} (eg. permission denied, file not found, etc.)
+ 
+ You can have up to two <map:handle-errors> elements - one of every type. By default (cocoon-2.0.4), no handler is defined for {{ResourceNotFound}} (ie. {{type="404"}}), hence the different error page which is produced by the Servlet Container. 
+ 
+ Typical problems may look like this: no matter how hard you customize your error2html stylesheet, you still get the same plain error page produced by cocoon servlet (ex: when missing a file needed by a {{<map:generate>}})
+ 
+ The sitemap fragment below shows the use of the two different types in one pipeline
+ 
+ {{{
+   <map:pipeline>
+     <map:match pattern="test/**">
+       <map:mount check-reload="yes" src="oreilly/sitemap.xmap" uri-prefix="test"/>
+     </map:match>
+     <map:handle-errors type="500">
+      <map:transform src="stylesheets/system/error-2-html.xsl"/>
+      <map:serialize/>
+     </map:handle-errors>
+     <map:handle-errors type="404">
+      <map:transform src="stylesheets/system/error404-2-html.xsl"/>
+      <map:serialize/>
+     </map:handle-errors>
+   </map:pipeline>
+ }}}
+ 
+ Remember that when a {{<map:handle-errors>}} is not found for the type of exception you want to process in the current pipeline, cocoon will try to find one in the parent sitemap (if using sub-sitemap). If no such handler is found, the exception will be handeld by the Cocoon Servlet !
+ 
+ -- [SergeColin]
- 
- 
- 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=SandBox , version: 105 on Fri May 16 07:32:10 2003 by 200.158.76.244

+ *** list item 2 sub item of the sub item