Re: Exception handling on init, prerender and preprocess

2007-01-27 Thread Craig McClanahan

On 1/26/07, JS Portal Support [EMAIL PROTECTED] 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





Exception handling on init, prerender and preprocess

2007-01-26 Thread JS Portal Support
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