Have a query about a standard way of designing
application exceptions in the EJB Tier.

In our current project all exception classes thrown
from the EJB Tier either accept a (String) or an
overloaded (String, Exception) as constuctor arg(s).

eg.

CreditLimitReachedException -

EJB Tier
---------
throw new CreditLimitReachedException("Credit limit
reached for User :" + aUserName + "Account no:" + x +
" amount:" + y);

Web Tier
---------
JSP:

catch(CreditLimitReachedException c)
{
        ErrorPage.msg("(A customized msg for Credit  limit is
reached)");

}

This way, the info contained in the exception object
(ie aUserName,amount etc) is not used.

Should the exception object have state initialized
through a constructor and corresponding getter methods
?

eg.

EJB Tier
---------
throw new CreditLimitReachedException("Credit limit
reached for User " , aUserName , x, y);

Web Tier
--------

catch(CreditLimitReachedException c)
{
        ErrorPage.msg("(A sophisticated msg for Credit limit
is reached) " + "..." +   c.getUserName() + "..."
+c.getAccountNo() + "..." +  c.getAmount());

}

I would like to know how others are handling this. Any
pointers appreciated..

rgds
- arun

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to