当前位置: 首页>>代码示例>>C++>>正文


C++ Exception::what方法代码示例

本文整理汇总了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;
}
开发者ID:karagog,项目名称:gutil,代码行数:8,代码来源:ilog.cpp

示例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);
 }
开发者ID:OggYiu,项目名称:rag-engine,代码行数:8,代码来源:collect_hooks_information.hpp

示例3: exception

 template< class Exception > explicit exception( const Exception &e, int line ):
     type_( UNKNOWN ),
     test_( 0 ),
     line_( line ),
     check_(),
     what_( e.what() ),
     message_()
 {
 }
开发者ID:AlbertYuChen,项目名称:block_down_sample_,代码行数:9,代码来源:exception.hpp

示例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();
      }
开发者ID:busjaeger,项目名称:cs410sp12,代码行数:9,代码来源:Exception.hpp

示例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());
}
开发者ID:dbohry,项目名称:xmlrpc-c,代码行数:12,代码来源:AbyssServer.cpp

示例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);
}
开发者ID:scottphilbrook84,项目名称:libsylph,代码行数:12,代码来源:UncaughtExceptionHandler.cpp

示例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());
	}
}
开发者ID:alemariusnexus,项目名称:gtatools,代码行数:37,代码来源:System.cpp

示例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);
}
开发者ID:cristianodelucca,项目名称:povray,代码行数:16,代码来源:rendertask.cpp

示例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());
}
开发者ID:yash101,项目名称:Organizer,代码行数:18,代码来源:httpserver.cpp

示例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 );
}
开发者ID:nyhnpya,项目名称:ClSockets,代码行数:24,代码来源:XmlOutputter.cpp

示例11: printException

void printException(const Exception &ex) {
	cout << "Exception: " << ex.what() << endl;
}
开发者ID:whh8b,项目名称:csir-project,代码行数:3,代码来源:docdb.cpp

示例12: f

		Exception(const Exception& e) : std::runtime_error(e.what()), f(e.file()),  l(e.line()), ep(e.ep) {}
开发者ID:vladon,项目名称:rant.kul,代码行数:1,代码来源:except.hpp

示例13: canio_ex_translator

//-----------------------------------------------------------------------------
// Exceptions translators
//-----------------------------------------------------------------------------
void canio_ex_translator(const Exception& e) {
    PyErr_SetString(PyExc_RuntimeError, e.what().c_str());
}
开发者ID:JIRL,项目名称:canio2,代码行数:6,代码来源:py.cpp

示例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());
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:5,代码来源:ExceptionBinding.cpp

示例15: exception

void ErrorHandler::exception(const Exception& exc)
{
	poco_debugger_msg(exc.what());
}
开发者ID:12307,项目名称:poco,代码行数:4,代码来源:ErrorHandler.cpp


注:本文中的Exception::what方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。