struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan M Crater" <jonathan_m_cra...@fanniemae.com>
Subject exception handling design
Date Thu, 23 Aug 2001 12:20:04 GMT
all--

i'm in the process of designing an exception handling scheme with which
struts will interact, and i wanted to solicit any ideas and best
practices out there, especially from those of you who might have done
this already.

i have a base exception with relevant methods to chain additional
exceptions to it, which will create a linked list of exceptions.  i plan
to have at least two subclasses of this base exception, one for
application exceptions, one for system exceptions.  when one or more
exception(s) is(are) encountered, i was thinking i would pass a constant
which holds a specific struts application.properties message key (e.g.,
"error.authentication" or "error.database") to each exception
constructor.  then, if one or more exceptions is encountered, i can
chain them all together and throw the base exception from the business
layer to the presentation layer, where it will be caught by a related
struts action class.  at that point, the action class can call some
utility method, passing it the base exception.  this utility method will
return a fully populated ActionErrors object, which the action class can
then check for size.  if it contains errors, the action class can return
an appropriate ActionForward object.

does anyone out there see any flaws with this type of setup?
suggestions?  comments?

thanks in advance.

jon



Mime
View raw message