Error Reporting Examples

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Message Queuing reports error conditions in two ways. It reports error conditions that indicate the failure of the API function and COM method calls that are made by the application, and (for API function calls) it reports the error conditions of the specific queue, message, and computer properties passed to Message Queuing.

Note

For a list of all error and information codes defined by Message Queuing, see Message Queuing Error and Information Codes.

Returning Error and Information Codes

Error and information codes returned by API function and COM method calls correspond to the highest-severity error condition encountered when trying to execute the call. In C/C++ applications, these error codes are returned in the HResult of the call. For COM method calls, Message Queuing creates an error object that contains a text description of the error.

Error conditions that are associated with a specific property passed to Message Queuing (such as an illegal property tag or insufficient privileges and permissions to set a property) are returned to the appropriate element of the optional aStatus array of one of the following property structures.

Note

COM applications cannot access this information.

If the application supplies an aStatus array, the status code for the property whose identifier and value are in position i in the corresponding aPropID and aPropVar arrays is returned in position i of the aStatus array (if no error was encountered for a property, Message Queuing stores the value MQ_OK). However, the aStatus array is always optional: if the application specifies a NULL array in the property structure, Message Queuing does not report property error conditions to the application.

The following example provides an application-defined C/C++ function and a Visual BasicĀ® error handler that can be used to interpret the error code values returned by Message Queuing.

For an example of Using
Reading error codes C/C++ Code Example: Reading Error Codes

 Visual Basic Code Example: Reading Error Codes