Compartilhar via


Extending and Modifying the Exception Handling Application Block

In its original state, the Exception Handling Application Block works well for typical exception handling scenarios, such as logging an exception message, wrapping one exception with another, or replacing an exception with a different exception. However, there may be times when you have to customize certain behaviors of the block to better suit your application's particular requirements. There are two ways to do this. You can extend the Exception Handling Application Block using the built-in extension points. In addition, you may choose modify the block by making changes to its source code.

You extend the Exception Handling Application Block through designated extension points. Typically, these are custom classes written by you that implement a particular interface or derive from an abstract class. Because these custom classes exist in your application space, you do not have to modify or rebuild the Exception Handling Application Block; instead, you can designate your extensions through configuration settings.

You can extend the block by adding a new type of exception handler or exception formatter. The following table lists the interfaces and base classes that you can use to extend the block.

Custom Provider or Extension

Interface or Base Class

Exception Handler

IExceptionHandler

Exception Formatter

ExceptionFormatter

For more details of how to extend and modify the block and Enterprise Library, see the following topics: