Here is the strategy I follow in JBossCMP:

Low-level non recoverable exceptions (SQLException, IOException...) are 
wrapped in an EJBException. (Not RemoteException or ServerException as 
is required by the spec).

When catching an Exception, first check for EJBException, and just 
rethrow.  (avoid EJBException in EJBException)

Only log an exception if wrapping with an exception that does not 
support sub exception (CreateException and RemoveException).



-dain


Jason Dillon wrote:

> Sounds like MainDeployer should be the one to log this exception.
> 
> I have noticed that we generally misuse exceptions in many places... ie. 
> catching exceptions to log, then rethrow, or just to ignore.  There are also 
> places where we wrap exceptions when we could really just add a checked 
> Exception to the method and let higher level logic handle the failure.  
> 
> This was the case with ServiceMBeanSupport.stopService() in previous 
> releases.  I changed this to declare a checked Exception which simplifies 
> implementing services, as they don't need to handle the exceptions that occu 
> here, the support class does that for you.
> 
> Anyways, my point is that I think we can clean up our exception/throwable 
> usage significantly.  Doing so will simplify code which is current handling 
> some exceptions as well as make it easier to debug, as we won't have a billon 
> traces for a single exception.
> 
> It is a big job though... to clean this up, which is why I think it has not 
> been attempted before.
> 
> We might also want to provide a guide for new developers on how to deal with 
> exception coding, as it seems to be a common problem.
> 
> --jason
> 



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to