diff options
-rw-r--r-- | jsonrpc/src/server/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/jsonrpc/src/server/mod.rs b/jsonrpc/src/server/mod.rs index 9d1f5b7..e2c3e3a 100644 --- a/jsonrpc/src/server/mod.rs +++ b/jsonrpc/src/server/mod.rs @@ -301,7 +301,8 @@ impl Server { // Check if the method exists within the service if let Some(method) = service.get_pubsub_method(&req.method_name) { let params = req.msg.params.unwrap_or(serde_json::json!(())); - response.result = match method(channel, req.msg.method, params).await { + let result = method(channel, req.msg.method, params); + response.result = match result.await { Ok(res) => Some(res), Err(err) => return err.to_response(Some(req.msg.id), None), }; @@ -315,7 +316,8 @@ impl Server { // Check if the method exists within the service if let Some(method) = service.get_method(&req.method_name) { let params = req.msg.params.unwrap_or(serde_json::json!(())); - response.result = match method(params).await { + let result = method(params); + response.result = match result.await { Ok(res) => Some(res), Err(err) => return err.to_response(Some(req.msg.id), None), }; |