Active Versus Passive Exception Handling

Posted on Friday, January 23, 2009


Exception handling is an important tool. The effective use of this tool would help in improving the reliability and availablility of the system.

Reliability is termed as the probability of failure-free software operation for a specified period of time in a specified environment. With good exception handling the system would be able to take corrective action and/or take an action which would ensure that the software will not fail.

Availability is defined as the uptime and is inversely proportional to the downtime and the recovery time. Good exception handling would ensure that if there is a failure then the problem can be isolated quickly and the recovery time is fast.

Thus effective exception handling would help both the reliability and availability of the software.

Lately there has been the much desired shift towards unchecked exceptions. Earlier, the client code had to catch a number of exceptions even though there was little that the client could do in scenarios such as programming errors or resource related errors.

What do you expect the client to do when the database is down? The best way would be to throw an unchecked exception through your layers and finally the presentation tier would deal with it so that the end user can see a relatively decent message on the screen.

Exception handling can be further classified into Active and Passive

  • Passive Exception Handling is when the exception is logged onto a file. Now the message would remain there unless someone looks at it and then acts upon it.
  • Active Exception Handling is when the exception message is pushed across for attention. An example would be to page the person or email the support group when an exception occurs. This push sends the message to the radar of concerned people/systems rather than waiting in a log file to be acted upon.

For critical pieces of the software it is essential that a strategy which combines active and passive exception handling is considered so that any failure is immediately looked upon so that recovery is faster. The reliability would also be higher as with active exception handling the faults would be potentially contained before they become failures.

Posted in: Architecture