Improved error handling on thread exit
This commit is contained in:
parent
08a66f52d3
commit
fc61ef3d04
1 changed files with 20 additions and 4 deletions
|
|
@ -80,12 +80,28 @@ namespace fc {
|
||||||
p->set_value();
|
p->set_value();
|
||||||
exec();
|
exec();
|
||||||
} catch ( fc::exception& e ) {
|
} catch ( fc::exception& e ) {
|
||||||
|
if( !p->ready() )
|
||||||
|
{
|
||||||
wlog( "unhandled exception" );
|
wlog( "unhandled exception" );
|
||||||
p->set_exception( e.dynamic_copy_exception() );
|
p->set_exception( e.dynamic_copy_exception() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // possibly shutdown?
|
||||||
|
std::cerr << "unhandled exception in thread '" << name << "'\n";
|
||||||
|
std::cerr << e.to_detail_string( log_level::warn );
|
||||||
|
}
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
|
if( !p->ready() )
|
||||||
|
{
|
||||||
wlog( "unhandled exception" );
|
wlog( "unhandled exception" );
|
||||||
p->set_exception( std::make_shared<unhandled_exception>( FC_LOG_MESSAGE( warn, "unhandled exception: ${diagnostic}", ("diagnostic",boost::current_exception_diagnostic_information()) ) ) );
|
p->set_exception( std::make_shared<unhandled_exception>( FC_LOG_MESSAGE( warn, "unhandled exception: ${diagnostic}", ("diagnostic",boost::current_exception_diagnostic_information()) ) ) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{ // possibly shutdown?
|
||||||
|
std::cerr << "unhandled exception in thread '" << name << "'\n";
|
||||||
|
std::cerr << boost::current_exception_diagnostic_information() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
p->wait();
|
p->wait();
|
||||||
my->boost_thread = t;
|
my->boost_thread = t;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue