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
015 package org.apache.tapestry.error;
016
017 import org.apache.tapestry.IRequestCycle;
018
019 /**
020 * Invoked by the {@link org.apache.tapestry.IEngine} if there's an uncaught
021 * exception (checked or runtime) processing a request. The ExceptionPresenter
022 * is responsible for presenting a exception message (or description) to the
023 * user. The default implementation activates the "Exception" page, but it is
024 * common to override this to do something application specific (typically,
025 * return to the Home page and display an error message there). This service
026 * also provides a good hook for creating a server-side log of exceptions.
027 *
028 * @author Howard M. Lewis Ship
029 * @since 4.0
030 * @see RequestExceptionReporter
031 */
032 public interface ExceptionPresenter
033 {
034
035 /**
036 * Report the exception and provide some response to the user in lieu of the
037 * expected result page.
038 *
039 * @param cycle
040 * the current request cycle
041 * @param cause
042 * the exception that was caught
043 */
044
045 void presentException(IRequestCycle cycle, Throwable cause);
046 }