I've looked at the message below, and it appears that your proposal is different from the current implementation within the Struts 1.1 beta.
If I'm wrong, please let me know. I opened a bug on this at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7393, and saw that you responded to it - but I can't tell if your response is confirming the bug, or it is "as designed." Thanks, Matt > -----Original Message----- > From: Dimitri Valdin [mailto:[EMAIL PROTECTED]] > Sent: Monday, March 25, 2002 3:08 AM > To: [EMAIL PROTECTED] > Subject: RE: Declarative Exception Handling - Any Documentation? > > > AppException was introduced just to serve this needs. It is > handled in other way as all other exceptions. Please have a > look at LogonAction in: > > http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg0 > 4149.html > > Dmitri > > >The reason I want to use Exceptions is because currently I am using > >LookupDispatchAction, and I have 2 methods, add & save, that > both call > >the "UploadFile" method. Currently, the UploadFile method returns > >ActionErrors, but it seems to be better coding to have "void > uploadFile > >throws UploadFileException", rather than "ActionErrors uploadFile". > > >The current architecture seems to limit 1 exception to only throw 1 > >message key - being that you define this 1 message key in > >struts-config.xml. What I would like is to throw an > exception with a > >(key, value) and having this key be used for the exception message. > > >So in my UploadAction class, rather than having: > > > if (fileName == null || fileName.length() == 0) { > > logCat.error("validation error: no file specified"); > > errors.add(ActionErrors.GLOBAL_ERROR, > > new ActionError("errors.required", > > resources.getMessage("label.mediaFile"))); > > return errors; > > } > > > >I'd like to do: > > > > if (fileName == null || fileName.length() == 0) { > > throw new FileUploadException("errors.required", > > > >resources.getMessage("label.mediaFile")); > > } > > > >My FileUploadException is: > > > >public class FileUploadException extends AppException { > > > > /** > > * Construct a new instance of this exception for the specified > >filename. > > * > > * @param key Key that contains the error message key > > * @param param Parameter value for insertion into message > > */ > > public FileUploadException(String key, String param) { > > super(key, param); > > } > >} > > > > > -- > > Diese E-Mail enthält vertrauliche und/oder rechtlich > geschützte Informationen. Wenn Sie nicht der richtige > Adressat sind oder diese E-Mail irrtümlich erhalten haben, > informieren Sie bitte sofort den Absender und vernichten Sie > diese Mail. Das unerlaubte Kopieren sowie die unbefugte > Weitergabe dieser Mail ist nicht gestattet. > > This e-mail may contain confidential and/or privileged > information. If you are not the intended recipient (or have > received this e-mail in error) please notify the sender > immediately and destroy this e-mail. Any unauthorized > copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > > > > -- > To unsubscribe, e-mail: > <mailto:struts-dev-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>