Wiebe de Jong wrote:

My struts application follows this pattern:



action <-> business delegate <-> session fa�ade <-> dao



and there are certain database errors that I want to be displayed to the
user via ActionMessages.



Currently, the fa�ade returns a record id (positive value) or error number
(negative value). The delegate passes the error value on to the action,
which creates the ActionMessage.



My co-workers are of the opinion that the fa�ade should return record ids or
exceptions, and that the delegate should capture and translate these
exceptions into error values, which are then passed to the action.



Which way is better? Are there any other methods of doing this?



Depending on how much information you actually want to show the end user, you might take an idea from the way that SQLException works, and include the record identifier in the exception class itself. That way, you wouldn't have to choose either-or, and the ultimate ActionMessage you return could draw from both the error number and the text of the exception message if it wanted to.




Wiebe de Jong

http://frontierj.blogspot.com <http://frontierj.blogspot.com/>




Craig



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to