本文整理汇总了C++中Exception::what方法的典型用法代码示例。如果您正苦于以下问题:C++ Exception::what方法的具体用法?C++ Exception::what怎么用?C++ Exception::what使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::what方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareExceptionData
ILog::LoggingData ILog::PrepareExceptionData(const Exception<false> &e)
{
LoggingData ret;
ret.MessageLevel = LogLevelError;
ret.Message = e.Message();
ret.Title = String::Format("%s caught", e.what());
return ret;
}
示例2:
void
throw_exception(Context const& ctx, Exception const& e)
{
BOOST_WAVETEST_OSSTREAM strm;
strm << "18: " << e.what() << std::endl;
hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
return this->base_type::throw_exception(ctx, e);
}
示例3: exception
template< class Exception > explicit exception( const Exception &e, int line ):
type_( UNKNOWN ),
test_( 0 ),
line_( line ),
check_(),
what_( e.what() ),
message_()
{
}
示例4: Exception
Exception( const std::string& whoString, int whereLine,
const std::string& whatString, const Exception& inner )
{
std::stringstream lineString;
lineString << whereLine;
_what = whoString + "(" + lineString.str() + "): " + whatString + "\n\t" + inner.what();
_code = inner.code();
}
示例5:
void
AbyssServer::Session::sendErrorResponse(Exception const& e) {
/*-----------------------------------------------------------------------------
Send a response indicating that the HTTP request failed, with HTTP status
code and text explanation 'e'. The response is HTML and contains an
appropriate content-type header, regardless of any content type that may be
set in the object already.
-----------------------------------------------------------------------------*/
this->setRespStatus(e.httpStatusCode());
this->sendErrorResponse(e.what());
}
示例6: handle
void DebugUncaughtExceptionHandler::handle(const Exception& ex) const {
StringBuffer buf;
buf << "Uncaught Exception: "<<ex.name()<<": "<<ex.what()<<'\n';
if(ex.tracemsg != null) {
buf << "Trace messages: \n";
Exception::TraceMessage * msg = ex.tracemsg;
do {
buf << " " << String(msg->message) << '\n';
} while((msg->next != null) && (msg = msg->next));
}
thisapp->fail(buf, ex._file, ex._line, false);
}
示例7: unhandeledException
void System::unhandeledException(Exception& ex)
{
QDateTime dt = QDateTime::currentDateTime();
QString logfileName(QString("exception-%1.log").arg(dt.toTime_t()));
CString bt = ex.getBacktrace();
QFile logfile(logfileName);
logfile.open(QFile::WriteOnly);
printf("%s\n%s\n", ex.what(), bt.get());
logfile.write("UNHANDELED EXCEPTION REPORT ");
logfile.write(dt.toString(Qt::ISODate).toLocal8Bit().constData());
logfile.write(" gtatools version ");
logfile.write(GTATOOLS_VERSION);
logfile.write("\n\n");
logfile.write("Unhandeled exception caught:\n\n");
logfile.write(ex.what());
logfile.write("\n\nBacktrace:\n\n");
if (!bt.isNull()) {
logfile.write(bt.get());
} else {
logfile.write("[Backtrace not supported on this system]");
}
logfile.flush();
QString exText = tr("Unhandeled Exception %1%2").arg(ex.what()).arg(logfileName);
if (QThread::currentThread() == qApp->thread()) {
QMessageBox::critical(NULL, tr("Unhandeled Exception"), exText);
} else {
fprintf(stderr, "### Unhandeled exception caught ###\n");
fprintf(stderr, "%s\n", exText.toLocal8Bit().constData());
}
}
示例8: SendFatalError
void RenderTask::SendFatalError(Exception& e)
{
// if the front-end has been told about this exception already, we don't tell it again
if (e.frontendnotified(true))
return;
POVMS_Message msg(kPOVObjectClass_ControlData, kPOVMsgClass_ViewOutput, kPOVMsgIdent_Error);
msg.SetString(kPOVAttrib_EnglishText, e.what());
msg.SetInt(kPOVAttrib_Error, 0);
msg.SetInt(kPOVAttrib_ViewId, viewData->GetViewId());
msg.SetSourceAddress(viewData->GetSceneData()->backendAddress);
msg.SetDestinationAddress(viewData->GetSceneData()->frontendAddress);
POVMS_SendMessage(msg);
}
示例9: log
void server::HttpServer::bad_request(server::HttpServerSession* session, Exception& e)
{
log(e.getStatusCode().toString());
session->connection->write("HTTP/1.0 500 Internal Server Error\r\nContent-Type: text/html\r\n");
std::stringstream str;
str << "<!DOCTYPE html>" << std::endl;
str << "<html><head><title>Internal Server Error: " << e.what() << "</title></head>";
str << "<body>";
str << "<h1><center>Internal Server Error</center></h1>";
str << "<b>Issue: The server encountered an error processing your request.</b>";
str << "<h2>Error Traceback:</h2>";
str << "<pre>" << e.getStatusCode().toString() << "</pre>";
str << "</body>";
str << "</html>";
session->connection->write("Content-Length: " + server::toString(str.str().size()) + "\r\n\r\n");
session->connection->write(str.str());
}
示例10: XmlElement
void
XmlOutputter::addFailedTest( Test *test,
TestFailure *failure,
int testNumber,
XmlElement *testsNode )
{
Exception *thrownException = failure->thrownException();
XmlElement *testElement = new XmlElement( "FailedTest" );
testsNode->addElement( testElement );
testElement->addAttribute( "id", testNumber );
testElement->addElement( new XmlElement( "Name", test->getName() ) );
testElement->addElement( new XmlElement( "FailureType",
failure->isError() ? "Error" :
"Assertion" ) );
if ( failure->sourceLine().isValid() )
addFailureLocation( failure, testElement );
testElement->addElement( new XmlElement( "Message", thrownException->what() ) );
for ( Hooks::iterator it = m_hooks.begin(); it != m_hooks.end(); ++it )
(*it)->failTestAdded( m_xml, testElement, test, failure );
}
示例11: printException
void printException(const Exception &ex) {
cout << "Exception: " << ex.what() << endl;
}
示例12: f
Exception(const Exception& e) : std::runtime_error(e.what()), f(e.file()), l(e.line()), ep(e.ep) {}
示例13: canio_ex_translator
//-----------------------------------------------------------------------------
// Exceptions translators
//-----------------------------------------------------------------------------
void canio_ex_translator(const Exception& e) {
PyErr_SetString(PyExc_RuntimeError, e.what().c_str());
}
示例14: translate
static void translate( const Exception &e )
{
std::string s = (boost::format("%1% : %2%") % e.type() % e.what()).str();
PyErr_SetString(PyExc_RuntimeError, s.c_str());
}
示例15: exception
void ErrorHandler::exception(const Exception& exc)
{
poco_debugger_msg(exc.what());
}