public class DefaultRequestExceptionHandler extends Object implements RequestExceptionHandler
RequestExceptionHandler
that displays the standard ExceptionReport page. Similarly to the
servlet spec's standard error handling, the default exception handler allows configuring handlers for specific types of
exceptions. The error-page/exception-type configuration in web.xml does not work in Tapestry application as errors are
wrapped in Tapestry's exception types (see OperationException
and ComponentEventException
).
Configurations are flexible. You can either contribute a ExceptionHandlerAssistant
to use arbitrary complex logic
for error handling or a page class to render for the specific exception. Additionally, exceptions can carry context for the
error page. Exception context is formed either from the name of Exception (e.g. SmtpNotRespondingException ->
ServiceFailure mapping
would render a page with URL /servicefailure/smtpnotresponding) or they can implement ContextAwareException
interface.
If no configured exception type is found, the default exception page SymbolConstants.EXCEPTION_REPORT_PAGE
is rendered.
This fallback exception page must implement the ExceptionReporter
interface.Constructor and Description |
---|
DefaultRequestExceptionHandler(RequestPageCache pageCache,
PageResponseRenderer renderer,
org.slf4j.Logger logger,
String pageName,
Request request,
Response response,
ComponentClassResolver componentClassResolver,
LinkSource linkSource,
ServiceResources serviceResources,
ExceptionReporter exceptionReporter,
Map<Class,Object> configuration) |
Modifier and Type | Method and Description |
---|---|
protected Object[] |
formExceptionContext(Throwable exception)
Form exception context either from the name of the exception, or the context the exception contains if it's of type
ContextAwareException |
void |
handleRequestException(Throwable exception)
Handles the exception thrown at some point the request was being processed
First checks if there was a specific exception handler/page configured for this exception type, it's super class or super-super class.
|
public DefaultRequestExceptionHandler(RequestPageCache pageCache, PageResponseRenderer renderer, org.slf4j.Logger logger, @Symbol(value="tapestry.exception-report-page") String pageName, Request request, Response response, ComponentClassResolver componentClassResolver, LinkSource linkSource, ServiceResources serviceResources, ExceptionReporter exceptionReporter, Map<Class,Object> configuration)
configuration
- A map of Exception class and handler values. A handler is either a page class or an ExceptionHandlerAssistant. ExceptionHandlerAssistant can be a classpublic void handleRequestException(Throwable exception) throws IOException
handleRequestException
in interface RequestExceptionHandler
exception
- The exception that was thrownIOException
protected Object[] formExceptionContext(Throwable exception)
ContextAwareException
exception
- The exception that the context is formed for${project.version} - Copyright © 2003-2015 The Apache Software Foundation.