On 9/25/06, Lindholm, Greg <[EMAIL PROTECTED]> wrote:


-----Original Message-----
From: Gerald Müllan [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 25, 2006 10:41 AM
To: MyFaces Discussion
Subject: Re: Navigation in response to an Exception

> Hi,
>
> what about catching the exception in the action method (i suppose an
> action method here)
> and giving a different outcome back?

This is the easy case and only works if the exception happens in the action.
Doesn't help if the exception happens during any other phase.

FWIW, Shale[1] tries to take a holistic approach to this problem.  It intercepts exceptions at every place where the framework calls in to the application (lifecycle callbacks, the action invocation, and so on), and supports a strategy pattern type replacement for what happens.

The default behavior is:

 * Exceptions that occur up to and including Invoke Application
  phase are logged and cached.

* After Invoke Application, if there were any cached exceptions,
  forward to a configured error page instead of to the page
  selected by the standard navigation rules.  The cached
  exceptions will be accumulated into an ApplicationException,
  which is also passed on through the same request attributes
  that a normal webapp exception handler page would use to
  figure out what error occurred.

It might be worth giving this a try, and providing feedback (to the Shale list) if it doesn't completely meet your needs.

Craig

[1] http://shale.apache.org

Reply via email to