Design of the Exception Handling Application Block

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

The Exception Handling Application Block is designed to achieve the following goals:

  • Encapsulate the logic used to perform the most common exception handling tasks into minimal application code.
  • Relieve developers of the requirement to write duplicate code and custom code for common exception handling tasks.
  • Allow exception handling policies to be changed after they have been deployed and to ensure that changes happen simultaneously and consistently.
  • Incorporate best practices for exception handling, as described in the Exception Management Architecture Guide.

Design Highlights

Figure 1 shows the interrelationships between the key classes in the Exception Handling Application Block.

Ff648855.EH-DES-01-DesignOverview(en-us,PandP.10).gif

Figure 1
Design of the Exception Handling Application Block

The client code interacts with the Exception Handling Application Block through the static method HandleException. This method is on the ExceptionPolicy class. The HandleException method uses a factory to create an object of type ExceptionPolicyImpl for the named policy. The ExceptionPolicyImpl object has a collection of ExceptionPolicyEntry objects. There is one object for each exception type that is specified in the configuration file for the named policy. For each exception type, the ExceptionPolicyEntry object contains a collection of objects that implements the IExceptionHandler interface. The collection is ordered and provides the sequence that the Exception Handling Application Block uses when executing the policy. Each object that implements the IExceptionHandler interface has associated configuration information that is specific to each type of handler.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.
Show: