FC Updates from BitShares and myself #21
1 changed files with 49 additions and 19 deletions
|
|
@ -182,22 +182,41 @@ namespace fc
|
||||||
*/
|
*/
|
||||||
string exception::to_detail_string( log_level ll )const
|
string exception::to_detail_string( log_level ll )const
|
||||||
{
|
{
|
||||||
fc::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << variant(my->_code).as_string() <<" " << my->_name << ": " <<my->_what<<"\n";
|
try {
|
||||||
for( auto itr = my->_elog.begin(); itr != my->_elog.end(); )
|
try {
|
||||||
{
|
ss << variant( my->_code ).as_string();
|
||||||
ss << itr->get_message() <<"\n";
|
} catch( std::bad_alloc& ) {
|
||||||
try
|
throw;
|
||||||
{
|
} catch( ... ) {
|
||||||
ss << " " << json::to_string( itr->get_data() )<<"\n";
|
ss << "<- exception in to_detail_string.";
|
||||||
}
|
}
|
||||||
catch( const fc::assert_exception& e )
|
ss << " " << my->_name << ": " << my->_what << "\n";
|
||||||
|
for( auto itr = my->_elog.begin(); itr != my->_elog.end(); )
|
||||||
{
|
{
|
||||||
ss << "ERROR: Failed to convert log data to string!\n";
|
try {
|
||||||
|
ss << itr->get_message() <<"\n";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ss << " " << json::to_string( itr->get_data() )<<"\n";
|
||||||
|
}
|
||||||
|
catch( const fc::assert_exception& e )
|
||||||
|
{
|
||||||
|
ss << "ERROR: Failed to convert log data to string!\n";
|
||||||
|
}
|
||||||
|
ss << " " << itr->get_context().to_string();
|
||||||
|
++itr;
|
||||||
|
} catch( std::bad_alloc& ) {
|
||||||
|
throw;
|
||||||
|
} catch( ... ) {
|
||||||
|
ss << "<- exception in to_detail_string.";
|
||||||
|
}
|
||||||
|
if( itr != my->_elog.end() ) ss<<"\n";
|
||||||
}
|
}
|
||||||
ss << " " << itr->get_context().to_string();
|
} catch( std::bad_alloc& ) {
|
||||||
++itr;
|
throw;
|
||||||
if( itr != my->_elog.end() ) ss<<"\n";
|
} catch( ... ) {
|
||||||
|
ss << "<- exception in to_detail_string.\n";
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
@ -207,12 +226,23 @@ namespace fc
|
||||||
*/
|
*/
|
||||||
string exception::to_string( log_level ll )const
|
string exception::to_string( log_level ll )const
|
||||||
{
|
{
|
||||||
fc::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << what() << ":";
|
try {
|
||||||
for( auto itr = my->_elog.begin(); itr != my->_elog.end(); ++itr )
|
ss << what() << ":";
|
||||||
{
|
for( auto itr = my->_elog.begin(); itr != my->_elog.end(); ++itr ) {
|
||||||
if( itr->get_format().size() )
|
if( itr->get_format().size() )
|
||||||
ss << " " << fc::format_string( itr->get_format(), itr->get_data() );
|
try {
|
||||||
|
ss << " " << fc::format_string( itr->get_format(), itr->get_data() );
|
||||||
|
} catch( std::bad_alloc& ) {
|
||||||
|
throw;
|
||||||
|
} catch( ... ) {
|
||||||
|
ss << "<- exception in to_string.\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch( std::bad_alloc& ) {
|
||||||
|
throw;
|
||||||
|
} catch( ... ) {
|
||||||
|
ss << "<- exception in to_string.\n";
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue