本文整理汇总了C++中_com_error类的典型用法代码示例。如果您正苦于以下问题:C++ _com_error类的具体用法?C++ _com_error怎么用?C++ _com_error使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了_com_error类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msg
void
task::error_reply( const _com_error& e, const std::string& method )
{
_bstr_t msg( _bstr_t(L"Error: ") + e.Description() + L": " + e.ErrorMessage() );
for ( auto& reply: reply_handlers_ )
reply( method, static_cast< const char *>( msg ) );
}
示例2: PrintErrorInfo
/*打印错误消息*/
void CDBOperation::PrintErrorInfo(_com_error &e){
std::cout << "Error information are as follows" << std::endl;
std::cout << "ErrorNo: " << e.Error() << std::endl;
std::cout << "Error Message :" << e.ErrorMessage() << std::endl;
std::cout << "Source : " << e.Source() << std::endl;
std::cout << "Error Description : " << e.Description() << std::endl;
}
示例3: HandleComErrorException
//*****************************************************************************
//* Function Name: HandleComErrorException
//* Description: Handle a _com_error exception. This routine is called from
//* catch blocks for _com_error exceptions.
//*****************************************************************************
HRESULT HandleComErrorException (
LPCTSTR p_lpszFile,
UINT p_uLine,
const _com_error& p_ce)
{
(void) HandleFacilityInternetComErrorException (p_ce);
// Preserve the logical thread's error object. This is cleared when
// _com_issue_error[ex] calls the Automation ::GetErrorInfo() function.
// Attach the raw interface pointer returned by _com_error::ErrorInfo()
// to our smart pointer. _com_error::ErrorInfo() AddRef's the raw
// interface pointer that it returns. We want to encapsulate this
// raw interface pointer in a smart pointer without performing an
// additional AddRef.
IErrorInfoPtr l_spErrorInfo (p_ce.ErrorInfo (), false /* fAddRef */);
if (l_spErrorInfo) {
// There is one reference to the error object in p_ce. There is another
// reference in l_spErrorInfo. Both of these references will be released
// by the time we leave the caller's catch block. The COM run-time's
// reference to the error object will have been cleared when
// _com_issue_error[ex] was called. By calling SetErrorInfo(),
// we preserve the logical thread's error object.
(void) ::SetErrorInfo (0 /* dwReserved */, l_spErrorInfo);
}
return p_ce.Error ();
}
示例4: OutputDBErrMsg
void CNHSQLServerDBO::OutputDBErrMsg(const _com_error& e)
{
const int nErrMsgLength(MAX_PATH);
wchar_t *pwchErrMsg = new wchar_t[nErrMsgLength]();
_snwprintf_s(pwchErrMsg, nErrMsgLength, _TRUNCATE, L"错误编号:%08lx 错误信息:%s 错误源:%s 错误描述:%s",
e.Error(),
e.ErrorMessage(),
(LPCWSTR)e.Source(),
(LPCWSTR)e.Description());
// 输出错误信息到输出窗口
OutputDebugStringW(L"\t");
OutputDebugStringW(pwchErrMsg);
OutputDebugStringW(L"\n");
// 输出错误信息到日志文件
if (0 != wcscmp(m_wchLogFilePath, L""))
{
// 当日志文件路径不为空时,写日志
CNHLogAPI::WriteLogEx(m_wchLogFilePath, LOG_ERR, L"NHSQLServerDBO", pwchErrMsg);
}
if (NULL != pwchErrMsg)
{
delete[] pwchErrMsg;
pwchErrMsg = NULL;
}
}
示例5: ExceptionInfo
void CFoxBase::ExceptionInfo(_com_error &e)
{
if(e.Description().length()>0)
ExceptionInfo(e.Description());
else
ExceptionInfo(e.ErrorMessage());
}
示例6: dump_com_error
void CADO::dump_com_error(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
g_logger.error("ADO Error Code = %08lx Code meaning = %s Source = %s Description = %s",
e.Error(), e.ErrorMessage(), (LPCTSTR)bstrSource, (LPCTSTR)bstrDescription);
}
示例7: on_excetion
void HiDBOracle::on_excetion(const char* name, const char* sql, _com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
stringstream oss;
oss<<"source:"<<bstrSource<<"\nDescription:"<<bstrDescription<<"\nerror message:"<<e.ErrorMessage();
HiDBHelperOnError("HiDBOracle::ExecuteQuery", oss.str().c_str(), sql, e.Error());
}
示例8: ErrorHandler
static void ErrorHandler(_com_error &e, char* ErrStr)
{
sprintf(ErrStr,"Error:\n");
sprintf(ErrStr,"%sCode = %08lx\n",ErrStr ,e.Error());
sprintf(ErrStr,"%sCode meaning = %s\n", ErrStr, (char*) e.ErrorMessage());
sprintf(ErrStr,"%sSource = %s\n", ErrStr, (char*) e.Source());
sprintf(ErrStr,"%sDescription = %s",ErrStr, (char*) e.Description());
}
示例9: DbError
void DbError(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
CUString msg;
msg.Format("\n\tSource : %s \n\tdescription : %s \n ",(LPCSTR)bstrSource,(LPCSTR)bstrDescription);
MessageBox(NULL, msg, "", MB_OK);
}
示例10: dump_com_error
void dump_com_error(_com_error &e)
{
wprintf(L"Error\n");
wprintf(L"\a\tCode = %08lx\n", e.Error());
wprintf(L"\a\tCode meaning = %s", e.ErrorMessage());
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
wprintf(L"\a\tSource = %s\n", (LPCSTR) bstrSource);
wprintf(L"\a\tDescription = %s\n", (LPCSTR) bstrDescription);
}
示例11: dump_com_error
void dump_com_error(_com_error &e)
{
_tprintf(_T("Oops - hit an error!\n"));
_tprintf(_T("\a\tCode = %08lx\n"), e.Error());
_tprintf(_T("\a\tCode meaning = %s\n"), e.ErrorMessage());
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
_tprintf(_T("\a\tSource = %s\n"), (LPCTSTR) bstrSource);
_tprintf(_T("\a\tDescription = %s\n"), (LPCTSTR) bstrDescription);
}
示例12: dump_com_error
static void dump_com_error(_com_error &e)
{
::AtlTrace("Error\n");
//TRACE1("\a\tCode = %08lx\n", e.Error());
//TRACE1("\a\tCode meaning = %s", e.ErrorMessage());
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
::AtlTrace("\a\tSource = %s\n", (LPCSTR) bstrSource);
::AtlTrace("\a\tDescription = %s\n", (LPCSTR) bstrDescription);
}
示例13: GetError
CString GetError(_com_error &e)
{
CString MsgBug;
_bstr_t Source(e.Source());
_bstr_t Description(e.Description());
MsgBug.Format( "Ups!!! \nSource = %s\nDescription= %s\n",(LPCSTR)Source, (LPCSTR)Description );
#ifdef _DEBUG
AfxMessageBox( MsgBug, MB_OK | MB_ICONERROR );
#endif
return MsgBug;
}
示例14: dump_com_error
void dump_com_error(_com_error &e)
{
CString strError;
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
// Print Com errors.
strError.Format(_T("Database Engine Error\n\nCode %08lx\nmean:%s\nSource: %s\nDescription: %s\n"),
e.Error(), e.ErrorMessage(), (LPTSTR) bstrSource, (LPTSTR) bstrDescription);
AfxMessageBox(strError,MB_OK+MB_ICONERROR);
}
示例15: ErrCom
// ErrCom Function
void ErrCom(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
// Print Com errors.
printf("Error\n");
printf("\tCode = %08lx\n", e.Error());
printf("\tCode meaning = %s\n", e.ErrorMessage());
printf("\tSource = %s\n", (LPCSTR) bstrSource);
printf("\tDescription = %s\n", (LPCSTR) bstrDescription);
}