------ Development Guide - Exception Pages ------ Jesse Kuhnert ------ 13 Nov 2006 ------ Custom Exception Pages One of the most common requests seen on the users mailing list is "how do I replace the default Tapestry exception page with my own custom page?". This section will attemp to clear that up. * Default hivemind configuration The Tapestry exception presenting logic works by using whatever configuration values are found in the global hivemind <<>> configuration point to specify which pages to use. <(using Page names)> The following fragment is the complete configuration used by the default Tapestry exception presenting services: +----------------------------------------------------------- +----------------------------------------------------------- * Override the core <<>> page with your own Using the configuration reference above we can see that we only need to override the default <<>> configuration property to have our own page used. So, for example - if you had written a custom page in your application called <<>> you would be able to make it the default exception page by adding this fragment to your application's <<>> configuration file: +----------------------------------------------------------- +----------------------------------------------------------- Your page would have to have a property called <<>>. A sample page class might look as follows: +----------------------------------------------------------- public abstract class MyCustomExceptionPage extends BasePage { private static Logger logger = Logger.getLogger(ExceptionPage.class); @InitialValue("false") public abstract boolean isPageNotFound(); public abstract void setPageNotFound(boolean pageNotFound); public void setException(Throwable t) { logger.error("an exception occured", t); if(t instanceof PageNotFoundException || t.getCause() instanceof PageNotFoundException) { setPageNotFound(true); } } } +-----------------------------------------------------------