When the Request Response Invocation Service in the interceptor receives an exception from a Request Response Service (or the interceptor encounters any other kind of exception), it returns one of the following values to the COM client:
ERROR_MOPERATIONEXCEPTION_THROWN (0xE2000042) ERROR_MEXCEPTION_THROWN (0xE2000043) ERROR_UNKNOWN_EXCEPTION_THROWN (0xE2000044)
The interceptor component supports the COM ISupportErrorInfo
interface and returns S_OK
to the call ISupportErrorInfo
::InterfaceSupportsErrorInfo
. Thus, when the interceptor returns an unsuccessful HRESULT
to the COM client, the client should call GetErrorInfo
on the calling thread to obtain extended error information through the IErrorInfo
interface. The file main
.cpp
in the sample.dat
project has sample code to show you how to do this:
void GetIErrorInfo( HRESULT hr ) { CComPtr<IErrorInfo> spErrorInfo; ostrstream ss; HRESULT hrei = GetErrorInfo(0, &spErrorInfo); if (hrei == S_OK) { CComBSTR Description; hrei = spErrorInfo->GetDescription(&Description); _ASSERTE(SUCCEEDED(hrei)); ss << "Error encountered (" << setbase(16) << hr << "). " << (char*)_bstr_t((BSTR)Description) << ends; } else { ss << "Error encountered (" << setbase(16) << hr << ")." << ends; \ } char* s = ss.str(); MessageBox(NULL, s, "TIBCOCOMInterceptor", MB_OK); delete s; }
When the logger component of the adapter receives an error code, it checks the application resource dll (TIBCOCOMMessage.dll
) as well as the system message-table resource to find out the corresponding string for it. When it fails to format the string, it displays the message, Could not format error/info message!
ERROR_UNKNOWN_IMPL_EXCEPTION
, with the appropriate coclass, Interface, and method name information. HRESULT
, the service component tries to get more information about the failure using the ISupportErrorInfo
interface. If the COM server does not implement this ISupportErrorInfo
interface, the service component is unable to get more information about the failure scenario and propagates a TIBCOCOMException
object with the HRESULT
code it retrieved from the COM server. Could not format error/info message!
is displayed.
TIBCO Adapter™ for COM User’s Guide Software Release 5.3, September 2005 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |