From 9ed9395c2c6d131e4eecec9a40e20d9204ccfdab Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 23 May 2022 11:58:41 -0700 Subject: [PATCH] return instead of ignore error (#1287) * return error instead of swallow error * changelog Co-authored-by: Bryan Stitt --- CHANGELOG.md | 1 + ethers-providers/src/transports/ws.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51b9830a..5d8daf6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ - Add `TransactionReceipt::to` and `TransactionReceipt::from` [#1184](https://github.com/gakonst/ethers-rs/pull/1184) - Add `From` and From> traits to `ValueOrArray` [#1199](https://github.com/gakonst/ethers-rs/pull/1200) +- Fix handling of Websocket connection errors [#1287](https://github.com/gakonst/ethers-rs/pull/1287) ## ethers-contract-abigen diff --git a/ethers-providers/src/transports/ws.rs b/ethers-providers/src/transports/ws.rs index 99e4a406..b1272bf8 100644 --- a/ethers-providers/src/transports/ws.rs +++ b/ethers-providers/src/transports/ws.rs @@ -401,8 +401,9 @@ where // Handle ws messages resp = self.ws.next() => match resp { Some(Ok(resp)) => self.handle(resp).await?, - // TODO: Log the error? - Some(Err(_)) => {}, + Some(Err(_)) => { + return Err(ClientError::UnexpectedClose); + } None => { return Err(ClientError::UnexpectedClose); },