예제 #1
0
void Logging::exceptionMessage(const exception & e, const int err_no)
{
	cerr << "\nERROR: " << e.what() << std::endl << flush;
	ERROR_LOG << "Top level exception: " << e.what() << std::endl << flush;
	releaseFile();
	exit(err_no);
}
예제 #2
0
 HPX_ATTRIBUTE_NORETURN void rethrow_exception(
     exception const& e, std::string const& func)
 {
     hpx::detail::throw_exception(
         hpx::exception(e.get_error(), e.what(), hpx::rethrow),
         func, hpx::get_error_file_name(e), hpx::get_error_line_number(e));
 }
예제 #3
0
	wstring StringConverter::ToExceptionString (const exception &ex)
	{
		const SystemException *sysEx = dynamic_cast <const SystemException *> (&ex);
		if (sysEx)
			return ToWide (sysEx->what()) + L": " + sysEx->SystemText() + L": " + sysEx->GetSubject();

		if (ex.what() && !string (ex.what()).empty())
			return ToWide (GetTypeName (typeid (ex)) + ": " + ex.what());
		
		return ToWide (GetTypeName (typeid (ex)));
	}
예제 #4
0
 void rethrows_if(
     hpx::error_code& ec, exception const& e, std::string const& func)
 {
     if (&ec == &hpx::throws) {
         hpx::detail::rethrow_exception(e, func);
     } else {
         ec = make_error_code(e.get_error(), e.what(),
             func.c_str(), hpx::get_error_file_name(e).c_str(),
             hpx::get_error_line_number(e),
             (ec.category() == hpx::get_lightweight_hpx_category()) ?
                 hpx::lightweight_rethrow : hpx::rethrow);
     }
 }
예제 #5
0
   void to_variant( const exception& e, variant& v, uint32_t max_depth )
   {
      FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" );
      variant v_log;
      to_variant( e.get_log(), v_log, max_depth - 1 );
      mutable_variant_object tmp;
      tmp( "code", e.code() )
         ( "name", e.name() )
         ( "message", e.what() )
         ( "stack", v_log );
      v = variant( tmp, max_depth );

   }
예제 #6
0
void
error_log::log_unhandled(const char *func, const char *file, int line, const exception& x)
{
   cerr << "unhandled exception! " << endl;
   cerr << x.what() << endl;
   cerr << "caught in " << func << ", at line " << line << " of " << file << endl;
}
예제 #7
0
파일: engine.cpp 프로젝트: rzymek/cxxsp
int cxxsp_engine::display_exception(request_rec *r, const exception& ex) {
    ap_set_content_type(r, "text/html");
    if(!r->header_only) {
        ap_rputs(DOCTYPE_HTML_4_0T, r);
        ap_rputs("<html><head><title>C++ Server Pages: Exception</title></head>\n",r);
        ap_rputs("<body><h2>C++ Server Pages: Exception</h2>\n",r);
        ap_rprintf(r,"<p>An exception (%s) occured during generation/compilation "
                   "of the C++ Server Page.</p>\n",typeid(ex).name());
        ap_rputs("<p>Here is the detailed message:</p>\n",r);
        ap_rputs("<pre style=\"border: solid black 1px; padding: 3px\">",r);
        string msg = ex.what();
        for(string::size_type i = 0; i<msg.size(); ++i)
            switch(msg[i]) {
            case '<':
                msg.replace(i,1,"&lt;");
                break;
            case '>':
                msg.replace(i,1,"&gt;");
                break;
            case '&':
                msg.replace(i,1,"&amp;");
                break;
            default:
                break;
            }
        ap_rputs(msg.c_str(),r);
        ap_rputs("</pre>\n",r);
        ap_rputs("</body></html>",r);
    }
    return OK;
}
예제 #8
0
		void onError(const char* mod,exception& ex) {
			tprintf("error loading module %s: %s\n",mod,ex.what());
			cppsp::CompileException* ce = dynamic_cast<cppsp::CompileException*>(&ex);
			if (ce != NULL) {
				tprintf("compiler output:\n%s\n",ce->compilerOutput.c_str());
			}
		}
예제 #9
0
int push_exception(lua_State * L, exception const & e) {
    exception ** mem = static_cast<exception**>(lua_newuserdata(L, sizeof(exception*))); // NOLINT
    *mem = e.clone();
    luaL_getmetatable(L, exception_mt);
    lua_setmetatable(L, -2);
    return 1;
}
예제 #10
0
 void NO_RETURN exception_factory::rethrow( const exception& e )const
 {
    auto itr = _registered_exceptions.find( e.code() );
    if( itr != _registered_exceptions.end() )
       itr->second->rethrow( e );
    throw e;
 }
예제 #11
0
void DisplayError(const exception& inErr)
{
	if (typeid(inErr) == typeid(HError))
		cerr << "Exception: " << static_cast<const HError&>(inErr).GetErrorString() << endl;
	else
		cerr << "Exception: " <<  inErr.what() << endl;
}
예제 #12
0
 void SessionImpl::failure( const shared_ptr< Session > session, const int status, const exception& error ) const
 {
     const auto handler = ( m_resource not_eq nullptr and m_resource->m_pimpl->m_error_handler not_eq nullptr ) ? m_resource->m_pimpl->m_error_handler : m_error_handler;
     
     if ( handler not_eq nullptr )
     {
         handler( status, error, session );
     }
     else
     {
         log( Logger::Level::ERROR, String::format( "Error %i, %s", status, error.what( ) ) );
         
         string body = error.what( );
         session->close( status, body, { { "Content-Type", "text/plain" }, { "Content-Length", ::to_string( body.length( ) ) } } );
     }
 }
예제 #13
0
파일: exception.cpp 프로젝트: 8ackl0/vmime
void exception::chainException(const exception& other)
{
	exception* e = other.clone();

	delete m_other;
	m_other = e;
}
예제 #14
0
void exception::default_show_function (const exception& err)
// Send a formatted report to standard error and to the Debug stream.
 {
 wstring s= err.What();
 std::wcerr << s;  // sic, should be werr.
 const wchar_t* buffer= s.c_str();
 ratwin::util::OutputDebugString (buffer);
 }
예제 #15
0
 BINLINE BException::BException(const exception& ex) throw() {
   const BException* bex = dynamic_cast<const BException*>(&ex);
   if (bex) {
     data = bex->data;
   }
   else {
     init(BExceptionC::INTERNAL, L"", L"", ex.what());
   }
 }
예제 #16
0
void print_exception(const string &msg, const exception &e)
{
    print_error_header();
    cout << msg << ": ";
    setColor(BLUE);
    cout << e.what();
    setColor(WHITE);
    cout << ".\n";
}
예제 #17
0
void exceptionMessage(const exception &excp) {
	string message, title;
	showCursor(true);

	message += "ERROR(S):\n\n";
	message += excp.what();

	title = "Error: Unhandled Exception";
	MessageBox(NULL, message.c_str(), title.c_str(), MB_ICONSTOP | MB_OK | MB_TASKMODAL);
}
예제 #18
0
void PopSessionCommand::Failure(const exception& exc)
{
	MojLogError(m_log, "Exception in command %s: %s", Describe().c_str(), exc.what());
	Cleanup();
	m_session.CommandFailed(this, MailError::INTERNAL_ERROR, exc);

	MojRefCountedPtr<PopCommandResult> result = GetResult();
	result->SetException(exc);
	result->Done();
}
예제 #19
0
void tls_set_error_info(exception const& exc)
{
    error_record* rec = get_error_record();

    JAG_ASSERT(rec);
    std::stringstream ss;
    output_exception(exc, ss);
    rec->m_message = ss.str();
    rec->m_err_code = exc.errcode();
}
예제 #20
0
inline void ReportException( const exception& e, ostream& os )
{
    try {
        const ArgException& argExcept = dynamic_cast<const ArgException&>(e);
        if( string(argExcept.what()) != "" ) 
            os << argExcept.what() << endl;
        DEBUG_ONLY(DumpCallStack(os))
    } 
    catch( exception& castExcept ) 
    { 
        if( string(e.what()) != "" )
        {
            os << "Process " << mpi::WorldRank() << " caught error message:\n"
               << e.what() << endl;
        }
        DEBUG_ONLY(DumpCallStack(os))
        mpi::Abort( mpi::COMM_WORLD, 1 );
    }
}
예제 #21
0
파일: record.cpp 프로젝트: 13steinj/memkeys
Record::Record(const string &fname, const uint32_t ln, const string &name,
               const exception &ex)
  : _filename(fname),
    _level(Level::OFF),
    _lineNumber(ln),
    _loggerName(),
    _message(),
    _methodName(name),
    _thrownMessage(ex.what())
{}
예제 #22
0
      /// <summary>Logs an STL exception to the console.</summary>
      /// <param name="src">Handler location</param>
      /// <param name="e">error</param>
      void  ConsoleWnd::Log(const GuiString& src, const exception&e)
      {
         ConsoleLock lock;

         *this << ENDL 
               << Cons::Exception << L"STL EXCEPTION: " 
               << Cons::Error     << e.what()
               << Cons::White     << L"...  Source: " 
               << Cons::Yellow    << src << ENDL;
      }
예제 #23
0
void print_and_clear_exception(const string& where, const exception& error) {
#ifdef GEODE_PYTHON
  if (typeid(error)==typeid(PythonError)) {
    cerr << where << ':' << endl;
    PyErr_Print();
    return;
  }
#endif
  cerr << where << ": " << typeid(error).name() << ", " << error.what() << endl;
}
예제 #24
0
string getMessage(const exception& e) {
	string result(e.what());
	try {
		rethrow_if_nested(e);
	} catch (const exception& innerException) {
		result += "\n" + getMessage(innerException);
	} catch (...) {}

	return result;
}
예제 #25
0
void DisplayError(
	const exception&	inErr)
{
	{
		StOKToThrow ok;
		PlaySound("error");
	}
	
	try
	{
		DisplayAlert("exception-alert", inErr.what());
	}
	catch (...)
	{
		GtkWidget* dlg = gtk_message_dialog_new(nil, GTK_DIALOG_MODAL,
			GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, "%s", inErr.what());
		gtk_dialog_run(GTK_DIALOG(dlg));
		gtk_widget_destroy(dlg);
	}
}
예제 #26
0
void DisplayError(const exception& inErr)
{
	try
	{
		if (typeid(inErr) == typeid(HError))
			HAlerts::Alert(nil, 205, static_cast<const HError&>(inErr).GetErrorString());
		else
			HAlerts::Alert(nil, 205, inErr.what());
	}
	catch (...) {}
}
예제 #27
0
파일: ACM.cpp 프로젝트: yuanbaopapa/ice
void
FactoryACMMonitor::handleException(const exception& ex)
{
    Lock sync(*this);
    if(!_instance)
    {
        return;
    }

    Error out(_instance->initializationData().logger);
    out << "exception in connection monitor:\n" << ex.what();
}
예제 #28
0
void EvalThread::exceptionInEval(exception &e)
{
  // 2006-0-09 AF, try to reconnect to OMC first.
  try
  {
    delegate_->closeConnection();
    delegate_->reconnect();
    run();
  }
  catch( exception &e )
  {
    // unable to reconnect, ask if user want to restart omc.
    QString msg = QString( e.what() ) + "\n\nUnable to reconnect with OMC. Do you want to restart OMC?";
    int result = QMessageBox::critical( 0, tr("Communication Error with OMC"),
      msg,
      QMessageBox::Yes | QMessageBox::Default,
      QMessageBox::No );

    if( result == QMessageBox::Yes )
    {
      delegate_->closeConnection();
      if( delegate_->startDelegate() )
      {
        // 2006-03-14 AF, wait before trying to reconnect,
        // give OMC time to start up
        msleep(1000);
        try
        {
          delegate_->reconnect();
          run();
        }
        catch( exception &e )
        {
          e.what();
          QMessageBox::critical( 0, tr("Communication Error"), tr("<B>Unable to communication correctlly with OMC.</B>") );
        }
      }
    }
  }
}
예제 #29
0
void ConnectCommand::ConnectFailure(const exception& e)
{
    CommandTraceFunction();

    MojLogError(m_log, "error connecting to server: %s", e.what());

    if(m_connection.get()) {
        m_connection->Shutdown();
    }

    m_session.ConnectFailure(e);
    Failure(e);
}
예제 #30
0
파일: NUbot.cpp 프로젝트: jnwest/robocup
/*! @brief 'Handles an unhandled exception; logs the backtrace to errorlog
    @param e the exception
 */
void unhandledExceptionHandler(exception& e)
{
    //!< @todo TODO: check whether the exception is serious, if it is fail safely
    errorlog << "UNHANDLED EXCEPTION. " << endl;
    void *array[10];
    size_t size;
    char **strings;
    size = backtrace(array, 10);
    strings = backtrace_symbols(array, size);
    for (size_t i=0; i<size; i++)
        errorlog << strings[i] << endl;
    errorlog << e.what() << endl;
}