Exception Handling Strategies
- Exception Handling Strategies
- Exception Handling Strategy - Overview
- Exception Handling Requirements
- Application Survival
- Notifying Relevant Parties
- Error Diagnostics and Reproduction
- Separation of Abstraction Layers
- More Readable and Maintainable Code
- Error Location and Context
- Error Causes, Types and Reactions
- Strategy Elements
- Error Detection
- Error Information Gathering
- Throwing Exceptions
- Propagating Exceptions
- Catching Exceptions
- An Exception Handling Strategy Template
- An Exception Class Template
- Throwing the AppException
- Propagating the AppException
- The ErrorInfo List
- Catching the AppException
- Avoid Exception Hierarchies
An Exception Handling Strategy Template
Jakob Jenkov |
Now that you have seen the requirements for an exception handling strategy, and seen what elements it consists of, I will try to put together an exception handling strategy template, that you can use for your own applications.
Remember, this template may not suit your application perfectly, so make the changes you need to make to it.
The strategy template consists of the following elements:
- An AppException and ErrorInfo template.
- An explanation of how to throw the AppException.
- An explanation of how to propagate the AppException.
- An explanation of how to extract information from the ErrorInfo list inside the AppException.
- An explanation of how to catch and handle the AppException.
Each of these parts are described in the following texts.
Tweet | |
Jakob Jenkov |