本文整理汇总了C++中std::runtime_error类的典型用法代码示例。如果您正苦于以下问题:C++ runtime_error类的具体用法?C++ runtime_error怎么用?C++ runtime_error使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了runtime_error类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleSampleError
void JointTrajGeneratorRML::handleSampleError(const std::runtime_error &err)
{
RTT::log(RTT::Error) << "Error while sampling trajectory: " << err.what() << RTT::endlog();
// Enter error state
this->error();
}
示例2: ShowAlert
void ShowAlert(const std::string message, const std::runtime_error& error) {
std::string alertMessage = std::string(message).append("\n\nCause: ").append(error.what());
CFStringRef cfTitle = CFStringCreateWithCString(NULL, "Oops something is wrong...", kCFStringEncodingUTF8);
CFStringRef cfMessage = CFStringCreateWithCString(NULL, alertMessage.c_str(), kCFStringEncodingUTF8);
CFUserNotificationDisplayNotice(0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, cfTitle, cfMessage, NULL);
CFRelease(cfTitle);
CFRelease(cfMessage);
}
示例3: pxsFmt
// --------------------------------------------------------------------------------------
// Exception::RuntimeError (implementations)
// --------------------------------------------------------------------------------------
Exception::RuntimeError::RuntimeError( const std::runtime_error& ex, const wxString& prefix )
{
IsSilent = false;
SetDiagMsg( pxsFmt( L"STL Runtime Error%s: %s",
(prefix.IsEmpty() ? L"" : pxsFmt(L" (%s)", WX_STR(prefix)).c_str()),
WX_STR(fromUTF8( ex.what() ))
) );
}
示例4: msg
// --------------------------------------------------------------------------------------
// Exception::RuntimeError (implementations)
// --------------------------------------------------------------------------------------
Exception::RuntimeError::RuntimeError( const std::runtime_error& ex, const wxString& prefix )
{
IsSilent = false;
const wxString msg( wxsFormat( L"STL Runtime Error%s: %s",
(prefix.IsEmpty() ? prefix.c_str() : wxsFormat(L" (%s)", prefix.c_str()).c_str()),
fromUTF8( ex.what() ).c_str()
) );
SetDiagMsg( msg );
}
示例5: displayErrorMessage
void ErrorAdapter::displayErrorMessage(const std::string& function,
const std::vector<std::string>& args, std::runtime_error& e) {
std::string msg = "Runtime Exception was caught when loading file ";
msg += function;
msg += " '";
msg += e.what();
msg += "'";
for (std::list<ErrorListener*>::iterator itr = m_listeners.begin();
itr != m_listeners.end(); ++itr) {
(*itr)->displayError(msg);
}
}
示例6: handling_invalid_server
void
handling_invalid_server(const std::string & db_type, const std::runtime_error& e, const std::string &collection,
const std::string &id)
{
switch (ObjectDbParameters::StringToType(db_type))
{
case ObjectDbParameters::COUCHDB:
{
std::string url = "http://foo:12323";
if (!collection.empty())
{
url.append("/" + collection);
if (!id.empty())
url.append("/" + id);
};EXPECT_EQ(std::string(e.what()), std::string("No response from server. : ") + url);
break;
}
case ObjectDbParameters::FILESYSTEM:
EXPECT_EQ(std::string(e.what()), std::string("Path /bogus/path/for/testing does not exist. Please create."));
break;
default:
throw std::runtime_error("Status test not implemented for " + db_type);
}
}
示例7: procErr
int CImportManager::procErr(std::runtime_error& exc, const CString& sSupplierName, bool bIsLast)
{
CString sFmt = LS (L_DOWNLOADS_IMPORT_HAS_BEEN_STOPPED);
CString sTmp;
sTmp.Format(sFmt, (LPCTSTR)sSupplierName);
CString sMsg = sTmp;
sMsg += " ";
sMsg += exc.what();
UINT nType = MB_ICONERROR;
if (!bIsLast) {
sMsg += " ";
sMsg += LS (L_REQUEST_TO_CONTINUE_IMPORT);
nType |= MB_YESNO;
} else {
nType |= MB_OK;
}
return ::MessageBox(m_hWizardWnd, (LPCTSTR)sMsg, LS (L_ERR), nType);
}
示例8: __TBB_CATCH
} __TBB_CATCH( std::runtime_error& error ) {
#if TBB_USE_EXCEPTIONS
REPORT("ERROR: %s\n", error.what() );
#endif /* TBB_USE_EXCEPTIONS */
}
示例9: operator
void operator() (std::runtime_error const& e) const
{
std::cout << "std::runtime_error: " << e.what() << std::endl;
}
示例10:
void
psi::reportRuntimeError (std::runtime_error const &e)
{
std::cerr << "Failed to locate file: " << e.what () << std::endl;
}
示例11: writeException
void DebugFile::writeException(std::runtime_error& e) {
_file << "(EXCEPTION) " << e.what() << std::endl;
}
示例12: prependContext
std::string Checker::prependContext( std::runtime_error& e, const char *name ) {
std::string s = "\\";
s.append( name );
s.append( e.what() );
return s;
}
示例13: is_error_500
bool is_error_500(std::runtime_error const & err)
{
std::string msg = std::string(err.what());
boost::algorithm::to_lower(msg);
return msg.find("500 internal server error") != std::string::npos;
}
示例14: operator
bool operator() (const std::runtime_error& e) const {
return std::string(e.what()).find(m_reason) != std::string::npos;
};
示例15: runtime_error_translator
void runtime_error_translator(std::runtime_error const & ex)
{
PyErr_SetString(PyExc_RuntimeError, ex.what());
}