001// Copyright 2005 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry.error;
016
017import org.apache.tapestry.IRequestCycle;
018
019/**
020 * Invoked by the {@link org.apache.tapestry.IEngine} if there's an uncaught exception
021 * (checked or runtime) processing a request. The ExceptionPresenter is responsible for presenting a
022 * exception message (or description) to the user. The default implementation activates the
023 * "Exception" page, but it is common to override this to do something application specific
024 * (typically, return to the Home page and display an error message there). This service also
025 * provides a good hook for creating a server-side log of exceptions.
026 * 
027 * @author Howard M. Lewis Ship
028 * @since 4.0
029 * @see RequestExceptionReporter
030 */
031public interface ExceptionPresenter
032{
033    /**
034     * Report the exception and provide some response to the user in lieu of the expected result
035     * page.
036     * 
037     * @param cycle
038     *            the current request cycle
039     * @param cause
040     *            the exception that was caught
041     */
042
043    public void presentException(IRequestCycle cycle, Throwable cause);
044}