5.8. Error Handling

In Click unhandled errors are directed to the ErrorPage for display. If applications require additional error handling they can create and register a custom error page in WEB-INF/click.xml. For example:

<pages package="com.mycorp.page" automapping="annotation"/>
  <page path="click/error.htm" classname="ErrorPage"/>

Generally applications handle transactional errors using service layer code or via a servlet Filter and would not need to include error handling logic in an error page.

Potential uses for a custom error page include custom logging. For example if an application requires unhandled errors to be logged to an application log (rather than System.out) then a custom ErrorPage could be configured. An example ErrorPage error logging page is provided below:

package com.mycorp.page.ErrorPage;

public class ErrorPage extends org.apache.click.util.ErrorPage {

    public void onDestroy() {