Handling Errors in COM+

The most problematic part of writing components is dealing with possible errors. Trying to determine what can go wrong and what to do about it can be challenging under the best conditions. Common errors that your component might check for and handle are failed network connections, security errors, and failures associated with unreachable objects.

Additionally, you can develop your own error codes to report interface-specific errors such as when a business rule has been violated.

In keeping with the COM+ programming model, an object can (and often does) call interface methods on other objects to perform work. Because programmers can write components in different programming languages, COM+ requires that all error-handling mechanisms be language-neutral, for example: HRESULTs and ErrorInfo collections.

This section includes topics, described in the following table, that discuss techniques for handling errors in COM+ applications, features in COM+ that affect failure behavior, and suggestions for diagnosing COM+ errors.

Topic Description
Strategies for Handling Errors in COM+
Lists and describes basic guidelines for handling errors in COM+, including when to use HRESULTs and ErrorInfo collections.
How COM+ Modifies Return Values
Identifies the single condition in which COM+ converts a standard HRESULT to a COM+ error code before passing it back to the caller.
Fault Isolation and Failfast Policy
Shows how fault isolation and the failfast policy affect COM+ behavior.
Finding the Source of an Error
Describes how you can diagnose the source and obtain a description of application errors.
Interpreting Error Codes
Identifies the predominant error-handling mechanism for Microsoft Visual C++, the Java language, and Microsoft Visual Basic.
Troubleshooting
Provides additional assistance in diagnosing errors.
Contacting Support
Identifies important problem-solving information you should provide when contacting support.

For detailed information on handling errors associated with various COM+ services, see the following sections:

Debugging COM+ Applications