Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Version status: 0.0.1 beta, unreleased

Icon
 

You love Tapestry, but missing the standard error-page/exception-type configuration option specified by the servlet spec? For some rarely occurring exceptions, wouldn't it be simpler to just catch them at the outermost layer rather than carry a typed exception through multiple layers of exceptions just so you could show a sensible error message to the user since you can't do anything more clever about it anyway? Unfortunately Tapestry wraps up all of your exceptions inside a ComponentEventException making the error-page/exception-type configuration in your web.xml useless. The default Tapestry exception page is great for development but you can't show that in production, can you?

The servlet spec, as always, is rather restrictive in regards to error-page configuration. If your email service or an external payment service goes down, you can't do much more than display an error message to the user, so why would you need to implement separate pages for it? Often, it'd be nicer if you could reuse the page template for this fatal exceptions but simply display a different error message. And it's only these certain exceptions that really shouldn't happen that you want to handle this way. Tapestry-exceptionpage allows you to contribute handlers for specific types of exceptions and to provide context for rendering the error page just right for that exception case.

If an EmailServiceException is thrown during an action request, user is directed to ServiceDown page with String context EmailService (i.e. to URL /servicefailure/emailnotsent). Tapestry-exceptionpage works both for regular action requests and ajax action request, in the case of former, the module will use Javascript to redirect to the error page.

If your custom-handled exception implements the interface ContextAwareException you can fully specify the context for the error page.

  • No labels