The Artima Developer Community
Sponsored Link

Legacy Design Forum
Designing with Exceptions

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Exceptions consuming Exceptions

Posted by Vikram B Kumar on June 08, 2000 at 4:59 PM

We are designing a huge system based on J2EE. There are classes that talk to Mainframe Database for data replication, EJBs for local data access, servlets and JSPs. And there's a huge meta-data which is the pivot of the whole replication/data access process. There are lots of critical points and some points could cause a chain reaction.

I don't want my developers to keep catching different exceptions. I designed a Base Exception Class and derived exceptions from the base depending on the module. (for eg Mainframe Replication, CICS Record parsing, Cache Aging etc) and put them in appropriate packages. Since we also have to throw SNMP/SMS events and log, we make these exceptions log/send events. (Exception handling for these is a different story.. :-( ). These exceptions consume the actual exceptions caused. Their constructors also need some info about the class which threw it, status code. These status codes again broadly fall into different categories. Whenever a worker class catches an exception it constructs this exception, passes demography info and some status. One module always throws exception belonging to its category. The next module (say EJB Access Beans) catch these and transform them into a type understandable by next layer (say servlets).

I spent quiet some time coming up with this framework. Its also based on some lessons learnt on ny previous projects.

My Q is this : Is the above described method a decent one? What are its cons?

Vikram






Replies:
  • a question Dilli December 16, 2000 at 9:05 PM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us