struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Schumeyer <rschume...@ieee.org>
Subject Re: ModuleException
Date Wed, 01 Nov 2006 17:33:08 GMT
Thanks for the reply.  It's not that I'm nervous about ModuleException, 
but rather that there are several ways to do it.  There is the 
traditional java way, ModuleException, your method of catching 
exceptions and forwarding to a global error page...and many others.  I 
was hoping to learn about the pros/cons of various methods before 
picking one.

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Rick,
>
>   
>> Let me give this one more try:  I'm considering using the
>> ModuleException class for exception handling.  It looks like a
>> reasonably painless way to go.  Is there any reason *not* to use this
>> method?
>>     
>
> You mean exception, right?
>
> I recall your initial message and your concerns about requiring Struts.
> But, as you mentioned, you will be using this only in Action classes,
> which already (duh!) require Struts.
>
> Are you nervous about using these exceptions?
>
>   
>> Or if anyone can point me to an example showing a better
>> method, that would be great also.
>>     
>
> Typically, if I catch an exception from some service that I called (say,
> an application-specific exception), I'll go ahead and just insert the
> error messages directly like this:
>
> 	    ActionMessages errors = new ActionMessages();
>
> 	    errors.add(ActionMessages.GLOBAL_MESSAGE,
> 		       super.getActionMessage("error.whatever",
> 					      "MyBundle", request));
>
> 	    super.saveErrors(request, errors);
>
> 	    return mapping.findForward("error");
>
>
> Note that "super.getActionMessage" is a method that I wrote to get an
> error message from a specific bundle.
>
> My global "error" page prints out any error messages available in the
> request. No need to throw another exception.
>
> It really just comes down to what you want to do.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFSL8y9CaO5/Lv0PARAjQjAKCYuBFRIoPyQwrdmm5Ox1tntZsl9gCgwGf2
> g6QF++OWAq6UiyNGzxXquvU=
> =IYly
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message