Improve logging of exceptions in p2p code (log via reflection instead of converting to strings)

This commit is contained in:
Eric Frias 2015-09-22 12:23:55 -04:00
parent c98eef2fb4
commit d92736617e

View file

@ -846,7 +846,7 @@ namespace graphene { namespace net { namespace detail {
} }
catch ( const fc::exception& e ) catch ( const fc::exception& e )
{ {
wlog( "unexpected exception on close ${e}", ("e", e.to_detail_string() ) ); wlog( "unexpected exception on close ${e}", ("e", e) );
} }
ilog( "done" ); ilog( "done" );
} }
@ -965,7 +965,7 @@ namespace graphene { namespace net { namespace detail {
} }
catch (const fc::exception& e) catch (const fc::exception& e)
{ {
elog("${e}", ("e", e.to_detail_string())); elog("${e}", ("e", e));
} }
}// while(!canceled) }// while(!canceled)
} }
@ -2943,7 +2943,7 @@ namespace graphene { namespace net { namespace detail {
"allow us to switch to: ${e}", "allow us to switch to: ${e}",
("num", block_message_to_send.block.block_num()) ("num", block_message_to_send.block.block_num())
("id", block_message_to_send.block_id) ("id", block_message_to_send.block_id)
("e", e.to_detail_string())); ("e", (fc::exception)e));
handle_message_exception = e; handle_message_exception = e;
discontinue_fetching_blocks_from_peer = true; discontinue_fetching_blocks_from_peer = true;
} }
@ -3736,7 +3736,7 @@ namespace graphene { namespace net { namespace detail {
} }
catch ( const fc::exception& e ) catch ( const fc::exception& e )
{ {
wlog( "client rejected message sent by peer ${peer}, ${e}", ("peer", originating_peer->get_remote_endpoint() )("e", e.to_string() ) ); wlog( "client rejected message sent by peer ${peer}, ${e}", ("peer", originating_peer->get_remote_endpoint() )("e", e) );
return; return;
} }
@ -5167,7 +5167,7 @@ namespace graphene { namespace net { namespace detail {
} }
catch ( const fc::exception& e ) catch ( const fc::exception& e )
{ {
elog( "${r}", ("r",e.to_detail_string() ) ); elog( "${r}", ("r",e) );
} }
destination_node->messages_to_deliver.pop(); destination_node->messages_to_deliver.pop();
} }