diff --git a/src/rpc/http_api.cpp b/src/rpc/http_api.cpp index c9a7786..281febd 100644 --- a/src/rpc/http_api.cpp +++ b/src/rpc/http_api.cpp @@ -98,9 +98,13 @@ void http_api_connection::on_request( const fc::http::request& req, const fc::ht auto call = var.as(); try { - auto result = _rpc_state.local_call( call.method, call.params ); - resp_body = fc::json::to_string( fc::rpc::response( *call.id, result ) ); - resp_status = http::reply::OK; + try + { + auto result = _rpc_state.local_call( call.method, call.params ); + resp_body = fc::json::to_string( fc::rpc::response( *call.id, result ) ); + resp_status = http::reply::OK; + } + FC_CAPTURE_AND_RETHROW( (call.method)(call.params) ); } catch ( const fc::exception& e ) { diff --git a/src/rpc/websocket_api.cpp b/src/rpc/websocket_api.cpp index 60ef706..0ff9304 100644 --- a/src/rpc/websocket_api.cpp +++ b/src/rpc/websocket_api.cpp @@ -96,14 +96,18 @@ std::string websocket_api_connection::on_message( exception_ptr optexcept; try { - auto result = _rpc_state.local_call( call.method, call.params ); - if( call.id ) + try { - auto reply = fc::json::to_string( response( *call.id, result ) ); - if( send_message ) - _connection.send_message( reply ); - return reply; + auto result = _rpc_state.local_call( call.method, call.params ); + if( call.id ) + { + auto reply = fc::json::to_string( response( *call.id, result ) ); + if( send_message ) + _connection.send_message( reply ); + return reply; + } } + FC_CAPTURE_AND_RETHROW( (call.method)(call.params) ) } catch ( const fc::exception& e ) {