Design patterns: exception / error handling

Design PatternsException Handling

Design Patterns Problem Overview


Is there any resource (web or book) describing exception handling / error handling design patterns?

There is a lot of literature on how to write clean code, and there are a lot of books covering design patterns. I have, however, never seen any design pattern covering the issue of where and how best to handle errors and how best to propagate an error appearing in a low-level function up the levels of abstraction.

Design Patterns Solutions


Solution 1 - Design Patterns

These patterns and best practices are often bound to a specific platform/language, so they are the first place to look for them.

As an example check the following links for java:

Going through such materials would give you a general idea to follow in exception handling mechanisms.

Also check other SO questions:

Solution 2 - Design Patterns

Best approach is never to swallow any exceptions within your application code. Hookup a handler to unhandled exceptions in your applications when bootstrapping where you can show an error message and do some logging.

Some decent books i've read recommended this approach.

http://thibautvs.com/blog/?p=2238 is a good one where it's mentioned.

Solution 3 - Design Patterns

Description of using exceptions on .NET (but not only) in details: http://msdn.microsoft.com/en-gb/library/5b2yeyab(v=vs.100).aspx

When one should use them, how to write them, how to handle them correctly and so forth...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohnBView Question on Stackoverflow
Solution 1 - Design PatternsBlaiseView Answer on Stackoverflow
Solution 2 - Design PatternsJManView Answer on Stackoverflow
Solution 3 - Design PatternsAlex DView Answer on Stackoverflow