Jenkov.com
Tutorials Books About
Exception Handling Strategies

1 Exception Handling Strategies
2 Exception Handling Strategy - Overview
3 Exception Handling Requirements
4 Application Survival
5 Notifying Relevant Parties
6 Error Diagnostics and Reproduction
7 Separation of Abstraction Layers
8 More Readable and Maintainable Code
9 Error Location and Context
10 Error Causes, Types and Reactions
11 Strategy Elements
12 Error Detection
13 Error Information Gathering
14 Throwing Exceptions
15 Propagating Exceptions
16 Catching Exceptions
17 An Exception Handling Strategy Template
18 An Exception Class Template
19 Throwing the AppException
20 Propagating the AppException
21 The ErrorInfo List
22 Catching the AppException
23 Avoid Exception Hierarchies




Exception Handling Strategies


In my work as consultant I often get to look into a clients existing applications. The exception handling I see in these applications is anywhere from almost random, to almost useful. There is often no formal, coherent exception handling strategy. Or, there is a strategy, but it is insufficient, meaning it does not contain all the rules, information and precautions necessary to fully handle all exceptions. That's why I decided to write this trail on exception handling strategies.

You may have noticed my trail on Java Exception Handling, which contains a list of text explaining a set of basic exception handling techniques. That trail however, does not cover how to put all these techniques into a coherent exception handling strategy.

In this trail I will explore how to put all the individual exception handling techniques into a single, coherent exception handling strategy. Don't treat this strategy as the one-and-only strategy possible. Treat it as a template for your own exception handling strategy. A suggestion, in other words. Make the adjustments you want or need in your concrete situation.

The exception handling strategy presented in this trail is language independent. You can implement this strategy in pretty much any language which has a try-catch-finally mechanism, including Java, Scala, C# etc.

Being an exploration of the subject, the suggestions inhere may be able to be improved. If you have any suggestions or comments, I will be happy to hear from you. I may also update this trail over time myself, as I get more knowlegde on the topic.

Feel Free to Contact Me

If you disagree with anything I write here about exception handling strategies, or just have comments, questions, etc, feel free to send me an email. You wouldn't be the first to do so. You can find my email address on the about page.



Connect with me: Newsletter - Get all my free tips!