From d19f67d94f2d0b8d4ab04fd29c9df324d053396f Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 14 Sep 2015 11:14:52 -0400 Subject: [PATCH] prevent yielding from catch block --- src/rpc/websocket_api.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rpc/websocket_api.cpp b/src/rpc/websocket_api.cpp index c618f4c..39381ab 100644 --- a/src/rpc/websocket_api.cpp +++ b/src/rpc/websocket_api.cpp @@ -81,6 +81,7 @@ std::string websocket_api_connection::on_message( if( var_obj.contains( "method" ) ) { auto call = var.as(); + exception_ptr optexcept; try { auto result = _rpc_state.local_call( call.method, call.params ); @@ -96,12 +97,16 @@ std::string websocket_api_connection::on_message( { if( call.id ) { - auto reply = fc::json::to_string( response( *call.id, error_object{ 1, e.to_detail_string(), fc::variant(e)} ) ); + optexcept = e.dynamic_copy_exception(); + } + } + if( optexcept ) { + + auto reply = fc::json::to_string( response( *call.id, error_object{ 1, optexcept->to_detail_string(), fc::variant(*optexcept)} ) ); if( send_message ) _connection.send_message( reply ); return reply; - } } } else