NOTE: This is outdated information that applies only to Tapestry 4. For current information see Tapestry5ExceptionPage.

How To Override Tapestry Default Exception Page

For development purposes, the tapestry exception page is extremely useful. It provides very informative info for development purposes, such as stack trace info, displays environment settings, etc... However, for a production environment, one may want to override this error page. This tutorial will explain how to.

1. Create html Error Page

2. Create corresponding java page

public class ErrorPage extends BasePage {
    public void setException(Throwable value){
        logger.logError(value);
        try {
                /* Send email with the error msg  */
                EmailService.sendEmail(value);
        } catch (Throwable exept) {
              log error
        } 
    }
}

3. Modify hivemodule.xml Add the following

        <contribution configuration-id="tapestry.InfrastructureOverrides">
              <property name="exceptionPageName" value="ErrorPage"/>
        </contribution>

Note, may want to consider have the deployment process only override the tapestry default exception page for production environment.

References

1. Email tapestry listserve Matt Larson, jake123; Subject title "Create error page T4.0.2"

2. http://tapestry.apache.org/tapestry4.1/developmentguide/exceptionpages.html

3. http://tapestry.apache.org/tapestry4/tapestry/hivedocs/config/tapestry.Infrastructure.html

4. http://issues.appfuse.org/browse/APF-271

Override_Tapestry_Default_Exception_Page (last edited 2011-01-02 15:40:35 by BobHarner)