From 1fecfd8821cfdea000bafa261ab4b36563858567 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 23 Dec 2022 12:03:48 -0800 Subject: [PATCH] don't unwrap an error --- web3_proxy/src/frontend/rpc_proxy_ws.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web3_proxy/src/frontend/rpc_proxy_ws.rs b/web3_proxy/src/frontend/rpc_proxy_ws.rs index 5208912a..11d43e74 100644 --- a/web3_proxy/src/frontend/rpc_proxy_ws.rs +++ b/web3_proxy/src/frontend/rpc_proxy_ws.rs @@ -246,13 +246,19 @@ async fn handle_socket_payload( Ok(response.into()) } _ => { - let (response, _) = app + let x = app .proxy_web3_rpc(authorization.clone(), json_request.into()) .await - // TODO: DO NOT UNWRAP HERE! ANY FAILING MESSAGES WILL KEPP THE CONNECTION! - .unwrap(); + // TODO: DO NOT UNWRAP HERE! ANY FAILING MESSAGES SHOULD KEEP THE CONNECTION! + .map_or_else( + |err| { + // need to think about this + todo!("do something to convert FrontendErrorResponse into a JsonRpcForwardedResponseEnum"); + }, + |(response, _)| response + ); - Ok(response) + Ok(x) } };