Centralized exception handling in .NET

Posted: (EET/GMT+2)

 

Exception objects are a great thing, but keeping a log of all those exceptions at runtime can be a nasty thing.

An article by Brian Noyes contains information about Microsoft's Exception Management Application Block, or EMAB.

With EMAB, you have a location where to "publish" your exceptions, and then let the EMAB store them in different formats: a file, a database, etc.

EMAB sounds like those products especially in the Java world that are able to catch all exceptions an application generates.

EMAB does just about the same, and only requires a single line of code:

catch (Exception ex)
{
  ExceptionManager.Publish(ex);
}

Quite neat.