Design patterns: exception / error handling

Solution 1:

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

  • Exception patterns wiki is a general patterns resource.

As an example check the following links for java:

  • Best Practices for Exception Handling
  • 15 Best practices about exception handling
  • Exception-Handling Antipatterns

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

Also check other SO questions:

  • Exception handling pattern
  • Java Style: Properly handling exceptions

Solution 2:

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.