How to display your own exception page

As of T5.0.5 it's not documented yet but Tapestry's "ExceptionReport" page is what you have to override. It's mentioned here (or check the T5 source).

Simply create your own page named ExceptionReport which implements the ExceptionReporter interface.

Here's an example ...

ExceptionReport.java

package yourapp.tapestry.pages;

import org.apache.tapestry.services.ExceptionReporter;

public class ExceptionReport implements ExceptionReporter
{
    private String error;

    public void reportException(Throwable exception)
    {
        error = exception.getLocalizedMessage();
    }

    public String getError()
    {
        return error;
    }
}

ExceptionReport.html

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" >
<head>
    <title>Error</title>
</head>
    <body>
        Error: ${error}
    </body>
</html>

Tapestry5ExceptionPage (last edited 2009-09-20 23:20:04 by localhost)