Exception Handling Requirements
Jakob Jenkov |
The purpose of an effective exception handling strategy can be grouped into a set of primary and secondary purposes, or requirements as we like to call them in software development. The requirements state what should happen if an exception (error) occurs in an application.
The primary requirements are the most important to meet with your exception handling strategy. The secondary requirements are not nearly as important, but it is still a good idea to take these into consideration, if you have the time and opportunity in your project.
Primary Requirements
The primary requirements of an effective exception handling strategy are:
- The application survives the exception and can continue to process events, requests, files etc. Or, the application shuts down gracefully.
- The relevant parties are notified. These parties include:
- End users
- System operators and administrators
- Developers
- Customers / owners of the application
- The exception / error can be diagnosed and reproduced, so it can be corrected.
Secondary Requirements
The secondary goals of an effective exception handling strategy are:
- Encapsulation / Separation of abstraction layers.
- More readable, maintainable code.
Both primary and secondary requirements are explained in more detail in the following texts.
Tweet | |
Jakob Jenkov |