    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005// http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012
    013package org.apache.tapestry5;
    014
    015import org.apache.tapestry5.services.RequestExceptionHandler;
    016
    017import java.io.IOException;
    018import java.util.List;
    019
    020/**
    021 * A contribution to the default {@link RequestExceptionHandler} service, this is mapped to an exception class,
    022 * allowing class specific (based on an inheritance search) handling of an exception.
    023 *
    024 * @see ContextAwareException
    025 */
    026public interface ExceptionHandlerAssistant
    027{
    028    /**
    029     * Handles the exception, returning a page class or link to redirect to.
    030     *
    031     * @param exception
    032     *         the exception as thrown
    033     * @param exceptionContext
    034     *         a page activation context that is derived from the root-most exception
    035     * @return either a page class or a {@link Link}; a page will be redirected to, with the exception context
    036     * as the page activation context
    037     * @throws IOException
    038     */
    039    Object handleRequestException(Throwable exception, List<Object> exceptionContext) throws IOException;
    040}