Aborted Handler Execution

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.

Figure 1 demonstrates a scenario where a handler in the handler pipeline aborts execution. In this scenario, the handler pipeline contains—in execution order—a Logging Handler, an Authorization Handler, and a Validation Handler. If, as shown in Figure 3, the Authorization Handler detects an authorization failure, it simply fails to invoke the next handler in the chain. Therefore, only the series of Invoke calls already executed will unwind from the stack. This means that only the handlers that have already executed can perform their post-processing tasks.

Ff650642.PI-DES-AbortedFlow(en-us,PandP.10).gif

Figure 1
The process flows through the handler pipeline when a handler aborts the method call to the target object

Also notice in Figure 1 how a handler can return an exception to the client code by adding it to the message that passes along the handler pipeline. This allows handlers earlier in the pipeline to carry out their post-processing tasks (such as, in this example, creating and writing a log message) as the Invoke stack unwinds. If, instead of passing it back through the message, a handler raises an unhandled exception, the previous handlers will not be able to execute their post-processing tasks.

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: