コード例 #1
0
ファイル: ilog.cpp プロジェクト: karagog/gutil
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
0
 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
0
 template< class Exception > explicit exception( const Exception &e, int line ):
     type_( UNKNOWN ),
     test_( 0 ),
     line_( line ),
     check_(),
     what_( e.what() ),
     message_()
 {
 }
コード例 #4
0
ファイル: Exception.hpp プロジェクト: busjaeger/cs410sp12
      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
0
ファイル: AbyssServer.cpp プロジェクト: dbohry/xmlrpc-c
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
0
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
0
static void showException(Exception& e){
    printf("Error: %s\n",e.what());
    const Instruction *ip = a->getIPException();
    if(ip){
        printf("Error at:");
        a->showop(ip);
        printf("\n");
    }else
          printf("Last line input: %s\n",a->getLastLine());
    if(e.fatal)
        exit(1);
    
    a->clearStack();
}
コード例 #8
0
ファイル: System.cpp プロジェクト: alemariusnexus/gtatools
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());
	}
}
コード例 #9
0
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);
}
コード例 #10
0
ファイル: httpserver.cpp プロジェクト: yash101/Organizer
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());
}
コード例 #11
0
ファイル: ilog.cpp プロジェクト: karagog/gutil
ILog::LoggingData ILog::PrepareExceptionData(const Exception<true> &e)
{
    LoggingData ret;
    ret.MessageLevel = LogLevelError;

    String data_string{""};
    const unordered_map<string, string> &keys( e.Data );
    if(keys.size() > 0){
        data_string = "\n\nException Data:";
        for(const auto &p : keys){
            data_string.Append(String::Format("\n\tKey: %s   Value: %s",
                                              p.first.data(),
                                              p.second.data()));
        }
    }

    ret.Message = String::Format("%s%s", e.Message().data(), data_string.ConstData());
    ret.Title = String::Format("%s caught%s",
                             e.what(),
                             e.GetInnerException() ? " (Inner exception follows immediately)" : "");
    return ret;
}
コード例 #12
0
ファイル: XmlOutputter.cpp プロジェクト: nyhnpya/ClSockets
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 );
}
コード例 #13
0
ファイル: docdb.cpp プロジェクト: whh8b/csir-project
void printException(const Exception &ex) {
	cout << "Exception: " << ex.what() << endl;
}
コード例 #14
0
ファイル: except.hpp プロジェクト: vladon/rant.kul
		Exception(const Exception& e) : std::runtime_error(e.what()), f(e.file()),  l(e.line()), ep(e.ep) {}
コード例 #15
0
ファイル: py.cpp プロジェクト: JIRL/canio2
//-----------------------------------------------------------------------------
// Exceptions translators
//-----------------------------------------------------------------------------
void canio_ex_translator(const Exception& e) {
    PyErr_SetString(PyExc_RuntimeError, e.what().c_str());
}
コード例 #16
0
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());
}
コード例 #17
0
ファイル: ErrorHandler.cpp プロジェクト: 12307/poco
void ErrorHandler::exception(const Exception& exc)
{
	poco_debugger_msg(exc.what());
}
コード例 #18
0
ファイル: ErrorHandler.cpp プロジェクト: HANDS-FREE/PIL
void ErrorHandler::exception(const Exception& exc)
{
    pi_dbg_error(exc.what());
}
コード例 #19
0
ファイル: Exception.cpp プロジェクト: cmcantalupo/geopm
    Exception::Exception(const Exception &other)
        : std::runtime_error(other.what())
        , m_err(other.m_err)
    {

    }
コード例 #20
0
 bool operator()(const Exception& e) {
     const std::string actual(e.what());
     return asserter::assert_contains(expected_, actual);
 }
コード例 #21
0
ファイル: ExceptionTest.cpp プロジェクト: KDE/ktutorial
void ExceptionTest::testConstructorEmpty() {
    Exception exception;

    QCOMPARE(exception.what(), "");
    QCOMPARE(exception.message(), QString(""));
}
コード例 #22
0
ファイル: RestBaseHandler.cpp プロジェクト: CoDEmanX/ArangoDB
void RestBaseHandler::handleError (Exception const& ex) {
  generateError(HttpResponse::responseCode(ex.code()),
                ex.code(),
                ex.what());
}
コード例 #23
0
ファイル: ExceptionDlg.cpp プロジェクト: jjiezheng/drag2d
	ExceptionDlg::ExceptionDlg(wxWindow* parent, const Exception& exp)
		: wxDialog(parent, wxID_ANY, "exception")
	{
		initLayout(exp.what());
	}
コード例 #24
0
ファイル: exception_formatter.cpp プロジェクト: frymode/xtrap
 std::string format_exception(const Exception& e)
 {
     return e.what();
 }
コード例 #25
0
ファイル: Client.cpp プロジェクト: raasakh/cpp-ethereum
void Client::onBadBlock(Exception& _ex) const
{
	// BAD BLOCK!!!
	bytes const* block = boost::get_error_info<errinfo_block>(_ex);
	if (!block)
	{
		cwarn << "ODD: onBadBlock called but exception (" << _ex.what() << ") has no block in it.";
		cwarn << boost::diagnostic_information(_ex, true);
		return;
	}

	badBlock(*block, _ex.what());

#if ETH_JSONRPC || !ETH_TRUE
	Json::Value report;

	report["client"] = "cpp";
	report["version"] = Version;
	report["protocolVersion"] = c_protocolVersion;
	report["databaseVersion"] = c_databaseVersion;
	report["errortype"] = _ex.what();
	report["block"] = toHex(*block);

	// add the various hints.
	if (unsigned const* uncleIndex = boost::get_error_info<errinfo_uncleIndex>(_ex))
	{
		// uncle that failed.
		report["hints"]["uncleIndex"] = *uncleIndex;
	}
	else if (unsigned const* txIndex = boost::get_error_info<errinfo_transactionIndex>(_ex))
	{
		// transaction that failed.
		report["hints"]["transactionIndex"] = *txIndex;
	}
	else
	{
		// general block failure.
	}

	if (string const* vmtraceJson = boost::get_error_info<errinfo_vmtrace>(_ex))
		Json::Reader().parse(*vmtraceJson, report["hints"]["vmtrace"]);

	if (vector<bytes> const* receipts = boost::get_error_info<errinfo_receipts>(_ex))
	{
		report["hints"]["receipts"] = Json::arrayValue;
		for (auto const& r: *receipts)
			report["hints"]["receipts"].append(toHex(r));
	}
	if (h256Hash const* excluded = boost::get_error_info<errinfo_unclesExcluded>(_ex))
	{
		report["hints"]["unclesExcluded"] = Json::arrayValue;
		for (auto const& r: h256Set() + *excluded)
			report["hints"]["unclesExcluded"].append(Json::Value(r.hex()));
	}

#define DEV_HINT_ERRINFO(X) \
		if (auto const* n = boost::get_error_info<errinfo_ ## X>(_ex)) \
			report["hints"][#X] = toString(*n)
#define DEV_HINT_ERRINFO_HASH(X) \
		if (auto const* n = boost::get_error_info<errinfo_ ## X>(_ex)) \
			report["hints"][#X] = n->hex()

	DEV_HINT_ERRINFO_HASH(hash256);
	DEV_HINT_ERRINFO(uncleNumber);
	DEV_HINT_ERRINFO(currentNumber);
	DEV_HINT_ERRINFO(now);
	DEV_HINT_ERRINFO(invalidSymbol);
	DEV_HINT_ERRINFO(wrongAddress);
	DEV_HINT_ERRINFO(comment);
	DEV_HINT_ERRINFO(min);
	DEV_HINT_ERRINFO(max);
	DEV_HINT_ERRINFO(name);
	DEV_HINT_ERRINFO(field);
	DEV_HINT_ERRINFO(transaction);
	DEV_HINT_ERRINFO(data);
	DEV_HINT_ERRINFO(phase);
	DEV_HINT_ERRINFO_HASH(nonce);
	DEV_HINT_ERRINFO(difficulty);
	DEV_HINT_ERRINFO(target);
	DEV_HINT_ERRINFO_HASH(seedHash);
	DEV_HINT_ERRINFO_HASH(mixHash);
	if (tuple<h256, h256> const* r = boost::get_error_info<errinfo_ethashResult>(_ex))
	{
		report["hints"]["ethashResult"]["value"] = get<0>(*r).hex();
		report["hints"]["ethashResult"]["mixHash"] = get<1>(*r).hex();
	}
	if (bytes const* ed = boost::get_error_info<errinfo_extraData>(_ex))
	{
		report["hints"]["extraData"] = toHex(*ed);
		try
		{
			RLP r(*ed);
			if (r[0].toInt<int>() == 0)
				report["hints"]["minerVersion"] = r[1].toString();
		}
		catch (...) {}
	}
	DEV_HINT_ERRINFO(required);
	DEV_HINT_ERRINFO(got);
	DEV_HINT_ERRINFO_HASH(required_LogBloom);
	DEV_HINT_ERRINFO_HASH(got_LogBloom);
	DEV_HINT_ERRINFO_HASH(required_h256);
	DEV_HINT_ERRINFO_HASH(got_h256);

	cwarn << ("Report: \n" + Json::StyledWriter().write(report));

	if (!m_sentinel.empty())
	{
		jsonrpc::HttpClient client(m_sentinel);
		Sentinel rpc(client);
		try
		{
			rpc.eth_badBlock(report);
		}
		catch (...)
		{
			cwarn << "Error reporting to sentinel. Sure the address" << m_sentinel << "is correct?";
		}
	}
#endif
}