IErrorInfo
-
I use a component that returns errors using the ISupportErrorInfo. I create this component inside another component and I can not access the error Description using the code below: CoInitialize(NULL); if (FAILED(CoCreateInstance(CLSID_AppSrv, NULL, CLSCTX_ALL, IID_IAppSrv, (void**)&pAppSrv))) { ::SysFreeString(bstrInCall); return; } hResult = pAppSrv->DispatchService3(bstrInCall , &vResponse); if (hResult == S_OK) *szXMLResponse = vResponse.bstrVal; else { HRESULT hr=S_OK; IErrorInfo *err; BSTR str; hr = GetErrorInfo(0, &err); if (FAILED(hr)) { *szXMLResponse = "Unable To Retrieve Error Message"; return; } hr = err->GetDescription(&str); if (SUCCEEDED(hr)) { CString szTemp; szTemp = "
003
"; szTemp += str; szTemp += ""; SysFreeString(str); *szXMLResponse = szTemp; } err->Release(); } Note that GetErrorInfo never fails but GetDescription always fails. Note that this happens when both the components are installed into 2 different packages in the COM+. Also the threading model of the component that produces the error is Apartment while the threading model of the component that fails to access the error is Neutral. Spiros Prantalos -
I use a component that returns errors using the ISupportErrorInfo. I create this component inside another component and I can not access the error Description using the code below: CoInitialize(NULL); if (FAILED(CoCreateInstance(CLSID_AppSrv, NULL, CLSCTX_ALL, IID_IAppSrv, (void**)&pAppSrv))) { ::SysFreeString(bstrInCall); return; } hResult = pAppSrv->DispatchService3(bstrInCall , &vResponse); if (hResult == S_OK) *szXMLResponse = vResponse.bstrVal; else { HRESULT hr=S_OK; IErrorInfo *err; BSTR str; hr = GetErrorInfo(0, &err); if (FAILED(hr)) { *szXMLResponse = "Unable To Retrieve Error Message"; return; } hr = err->GetDescription(&str); if (SUCCEEDED(hr)) { CString szTemp; szTemp = "
003
"; szTemp += str; szTemp += ""; SysFreeString(str); *szXMLResponse = szTemp; } err->Release(); } Note that GetErrorInfo never fails but GetDescription always fails. Note that this happens when both the components are installed into 2 different packages in the COM+. Also the threading model of the component that produces the error is Apartment while the threading model of the component that fails to access the error is Neutral. Spiros PrantalosWhat do you do on server side? Michel It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard -
What do you do on server side? Michel It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeardThe STA component is a gate to some services. The Neutral component actually accesses these services. The peculiar case is that if I will take the neutral component outside the COM+ it will retrieve the error info raised by the first component Spiros Prantalos
-
The STA component is a gate to some services. The Neutral component actually accesses these services. The peculiar case is that if I will take the neutral component outside the COM+ it will retrieve the error info raised by the first component Spiros Prantalos
First, you should check for S_FALSE from your call to GetErrorInfo(). S_FALSE means that there was no error info to return. Second, I don't know exactly what you want. Are you sure the server sets the error info? Michel It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard -
First, you should check for S_FALSE from your call to GetErrorInfo(). S_FALSE means that there was no error info to return. Second, I don't know exactly what you want. Are you sure the server sets the error info? Michel It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeardOk let me be more specific. 1. I am sure that the component sets the info in the IerrorInfo for 2 reasons: a. I can receive them and display them from an ASP page b. I can receive them and display them from the debug program of the second component as long as the second component is not inserted in the COM+. In other words using either the debug or the release version of the second component I can receive the err->GetDescription(&str) never fails. On the contrary when the com is inserted in the COM+ the same method fails. The error number that I receive in the HRESULT id -2147417842 and unfortunately does not correspond to a common error code. 2. The whole idea is like this: COM2<------>COM1<------>SERVICES COM1 and COM2 live in different packages of the COM+. COM1 is the gate to some services. COM2 and COM1 are both declared as server in the COM+. COM2's threading model is Neutral while COM1's threading model is Apartment. The weird phenomenon in that case is that everything fails only if they are both in the the COM+. Thank you for your time. Spiros Prantalos