How Do I Handle an Error Triggered by a COM Object? (Magic xpa 3.x)
You can capture errors generated by a COM object by using the Magic xpa COMError() function. COMError returns the last COM generated error. The syntax is:
COMError(number)
where number determines what kind of information is passed back. The value returned is always an alpha string.
-
1 returns the error description
-
2 returns the name of the COM object
-
3 returns the index number
-
4 returns the help file for that error
-
5 returns the context number
-
0 returns the HRESULT code
Hint: You can encapsulate this function in one program or global function, which you can call to check for errors and give a message to the user if an error is found, or to log the error.
Also note that while you are debugging COM objects this information is always found in the Magic xpa debugger activity log.