In certain instances, a single method call may cause multiple related errors to occur. A developer may choose to provide the caller with a chain of errors that report all the exceptions that were triggered. It's called an error chain because the developer catching the exception only sees one of the exceptions in the chain, then the developer uses the InnerException property to get the next exception in the chain. Using the InnerException object, the developer can ask that object for its InnerException and so on, until InnerException returns null. The difficult part of chaining exceptions is that the InnerException property is read-only. This means that chaining exceptions is not just a matter of setting an exception object's InnerException property. To build an exception chain:
Tip
|