• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ exception类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中exception的典型用法代码示例。如果您正苦于以下问题:C++ exception类的具体用法?C++ exception怎么用?C++ exception使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了exception类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: exceptionMessage

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);
}
开发者ID:xstreck1,项目名称:TREMPPI,代码行数:7,代码来源:logging.cpp


示例2: rethrow_exception

 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));
 }
开发者ID:7ev3n,项目名称:hpx,代码行数:7,代码来源:throw_exception.cpp


示例3: ToExceptionString

	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)));
	}
开发者ID:josejamilena,项目名称:veracrypt,代码行数:11,代码来源:StringConverter.cpp


示例4: rethrows_if

 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);
     }
 }
开发者ID:7ev3n,项目名称:hpx,代码行数:13,代码来源:throw_exception.cpp


示例5: to_variant

   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 );

   }
开发者ID:FollowMyVote,项目名称:fc,代码行数:13,代码来源:exception.cpp


示例6:

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;
}
开发者ID:Lexus89,项目名称:wifi-arsenal,代码行数:7,代码来源:error_log.cpp


示例7: ap_set_content_type

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;
}
开发者ID:rzymek,项目名称:cxxsp,代码行数:31,代码来源:engine.cpp


示例8: onError

		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());
			}
		}
开发者ID:Safe3,项目名称:workspace,代码行数:7,代码来源:cppsp_standalone.C


示例9: push_exception

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;
}
开发者ID:dumganhar,项目名称:lean-osx,代码行数:7,代码来源:exception.cpp


示例10: rethrow

 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;
 }
开发者ID:FollowMyVote,项目名称:fc,代码行数:7,代码来源:exception.cpp


示例11: DisplayError

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;
}
开发者ID:BackupTheBerlios,项目名称:mrs-svn,代码行数:7,代码来源:HError.cpp


示例12: failure

 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( ) ) } } );
     }
 }
开发者ID:gitforks,项目名称:restbed,代码行数:16,代码来源:session_impl.cpp


示例13: chainException

void exception::chainException(const exception& other)
{
	exception* e = other.clone();

	delete m_other;
	m_other = e;
}
开发者ID:8ackl0,项目名称:vmime,代码行数:7,代码来源:exception.cpp


示例14: default_show_function

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);
 }
开发者ID:jdlugosz,项目名称:repertoire,代码行数:8,代码来源:exception.cpp


示例15: throw

 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());
   }
 }
开发者ID:digideskio,项目名称:byps,代码行数:9,代码来源:BException.hpp


示例16: print_exception

void print_exception(const string &msg, const exception &e)
{
    print_error_header();
    cout << msg << ": ";
    setColor(BLUE);
    cout << e.what();
    setColor(WHITE);
    cout << ".\n";
}
开发者ID:PeterMishustin,项目名称:Voxel,代码行数:9,代码来源:log.cpp


示例17: exceptionMessage

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);
}
开发者ID:MoLAoS,项目名称:Mandate,代码行数:10,代码来源:platform_util.cpp


示例18: Failure

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();
}
开发者ID:Garfonso,项目名称:app-services,代码行数:10,代码来源:PopSessionCommand.cpp


示例19: tls_set_error_info

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();
}
开发者ID:Rogaven,项目名称:jagpdf,代码行数:10,代码来源:capiruntime.cpp


示例20: ReportException

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 );
    }
}
开发者ID:andreasnoack,项目名称:Elemental,代码行数:19,代码来源:impl.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ executor类代码示例发布时间:2022-05-31
下一篇:
C++ example_state_view类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap