Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to catch an exception thrown by MSXML?

From: "Anthony Jones" <AnthonyWJones@------------.--->
To: NULL
Date: 10/1/2008 9:40:00 PM

"JoeSchmoe112" <JoeSchmoe112@d...> wrote in message 
news:41619253-B8E2-4EE4-9D7C-C1F03086B966@m......
> Consider this function:
>
> BOOL GetSingleNodeV(const MSXML2::IXMLDOMDocumentPtr pXMLDoc, const 
> CString
> &strPath, CString &StrValue)
> {
> BOOL bRetCode=FALSE;
>
> BSTR bstrQstr = strPath.AllocSysString();
> IXMLDOMNodePtr o;
> o = pXMLDoc->selectSingleNode( bstrQstr);
> if (o!=NULL)
> {
> HRESULT hr=o->get_text(&bstrQstr);
> if (hr==S_OK)
> {
> StrValue = bstrQstr;
> bRetCode = TRUE;
> }
> else
> {
> StrValue="";
> }
> }
> //o->Release();
> SysFreeString(bstrQstr);
>
> return bRetCode;
> }
>
> Call to selectSingleNode sometimes works as expected but sometimes it 
> throws
> an exception. How can I extract additional information about this 
> exception?

You can access details about errors generated by COM components with the 
_com_error exception:-

try
{
  // your code
}
catch (_com_error &e)
{
  // here you can use _com_error members such as e.Description()
}


-- 
Anthony Jones - MVP ASP/ASP.NET



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent