[英]How can I determine at runtime whether there is a catch block for a particular C++ exception class?
[英]How can I handle exception in catch block in c++
說我有代碼
try
{
....
}
catch()
{
.... // exception occur here ... how to handled.
}
c ++中是否有任何機制可以處理上述情況。
如果您認為這是您真正想要的,則可以這樣做:
try
{
try
{
//...
}
catch( ... )
{
//...
if( .. )
throw std::runtime_exception( "error occured" );
}
}
catch( std::runtime_exception& e )
{
// handle exception of exception handler
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.