Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. IErrorInfo

IErrorInfo

Scheduled Pinned Locked Moved C / C++ / MFC
comhelpannouncement
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Spiros
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • S Spiros

      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

      L Offline
      L Offline
      Le centriste
      wrote on last edited by
      #2

      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.
      - TreeBeard

      S 1 Reply Last reply
      0
      • L Le centriste

        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.
        - TreeBeard

        S Offline
        S Offline
        Spiros
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • S Spiros

          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

          L Offline
          L Offline
          Le centriste
          wrote on last edited by
          #4

          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

          L 1 Reply Last reply
          0
          • L Le centriste

            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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Ok 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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups