1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 // ---------------------------------------------------------------------------
9 // ---------------------------------------------------------------------------
17 // ---------------------------------------------------------------------------
18 // COMException class. Implements exception API for standard COM-based error info
19 // ---------------------------------------------------------------------------
21 COMException::~COMException()
25 if (m_pErrorInfo != NULL)
26 m_pErrorInfo->Release();
29 IErrorInfo *COMException::GetErrorInfo()
31 LIMITED_METHOD_CONTRACT;
33 IErrorInfo *pErrorInfo = m_pErrorInfo;
34 if (pErrorInfo != NULL)
39 void COMException::GetMessage(SString &string)
41 STATIC_CONTRACT_THROWS;
42 STATIC_CONTRACT_GC_NOTRIGGER;
44 if (m_pErrorInfo != NULL)
46 BSTRHolder message(NULL);
47 if (SUCCEEDED(m_pErrorInfo->GetDescription(&message)))
48 string.Set(message, SysStringLen(message));