Re: [Webwork-devel] ResultException in prepare()
Brought to you by:
baldree,
rickardoberg
From: <Jim...@do...> - 2002-01-23 00:05:54
|
I would like it in prepare because we often instantiate an object in=20 prepare. Then, the subsequent setXXX methods can have an object to go=20 against, as opposed to storing the setXXX values in intermediate dummy=20 strings and such. Now, if there is an error instantiating this object in prepare(), such as=20 a finder exception, I would like to addError() and get the heck out with a = ResultException(INPUT). Without this, I have to wait until doExecute() to=20 bail, which means I have to wrap all of my setters with a "if (object !=3D = null)" methods. It seems much cleaner to extend the try block to include the getAction()=20 call. As to extending RuntimeException, I ran into a situation where I was=20 extending ResultException, and it was more convenient for me to have it as = a RuntimeException. I didn't see any design issues, especially since you=20 are expecting it to be only called in execute(). I can think of situations = when I would prefer it to be called in prepare(). (Full circle, no?) ;-) -jim Rickard <ri...@mi...> 01/22/2002 06:40 PM =20 To: Jim...@do... cc: web...@li... Subject: Re: [Webwork-devel] ResultException in prepare() Jim...@do... wrote: > It would be handy to be able to throw a ResultException from prepare(),=20 > especially in our Update actions. Any hope of extending the try block in = > ServletDispatcher around the ActionFactory.getAction(actionName) method? Well, no, not really. ResultException is just a fancier way of selecting=20 the return value from execute(), and prepare() is not done as a part of=20 that process, but rather as a part of the instantiation. Why do you want it? > Also, I would suggest that ResultException extend RuntimeException.=20 Well.. it doesn't make much difference for execute() since it throws=20 Exception. /Rickard --=20 Rickard =D6berg Author of "Mastering RMI" Chief Architect, TheServerSide.com The Middleware Company - We Build Experts! |