You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by JS Portal Support <su...@jsportal.com> on 2007/01/27 08:27:50 UTC
Exception handling on init, prerender and preprocess
Hi,
As the AbstractViewController does not throw Exceptions on its init(),
prerender() and preprocess(), I'm catching the exceptions in these methods
in my own classes extending the AbstractViewController and build my own
dispatching or logging. Why can these methods not utilize shale's exception
handling?
Regards,
Joost
Re: Exception handling on init, prerender and preprocess
Posted by Craig McClanahan <cr...@apache.org>.
On 1/26/07, JS Portal Support <su...@jsportal.com> wrote:
>
> Hi,
>
> As the AbstractViewController does not throw Exceptions on its init(),
> prerender() and preprocess(), I'm catching the exceptions in these methods
> in my own classes extending the AbstractViewController and build my own
> dispatching or logging. Why can these methods not utilize shale's
> exception
> handling?
You can let Shale's exception handling deal with exceptions, but you will
have to wrap a checked exception (i.e. an exception that does not extend
RuntimeException) in order to be able to throw it. Because
javax.faces.FacesException *is* a RuntimeException, I generally do something
like this if I want, say, an IOException to be handled by the Shale
machinery.
try {
... some operation that can throw an exception ...
} catch (IOException e) {
throw new FacesException(e);
}
In the code that ultimately handles exceptions, you'll likely want to unwrap
FacesException instances that have a root cause, to log what really
happened.
Craig
Regards,
> Joost
>
>
>