From eb3b98426fff12676fb89e0d695dfe295cb73eb7 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 11 Sep 2024 13:26:00 +1200 Subject: [PATCH] Improved error handling. --- test/async/websocket/client.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/async/websocket/client.rb b/test/async/websocket/client.rb index 9d7ced8..76cbc04 100644 --- a/test/async/websocket/client.rb +++ b/test/async/websocket/client.rb @@ -17,9 +17,13 @@ connection.write(message) end - connection.close + connection.shutdown rescue Protocol::WebSocket::ClosedError # Ignore this error. + rescue Errno::EPIPE + # Ignore this error: the client has closed the connection ungracefully. + ensure + connection.close end or Protocol::HTTP::Response[404, {}, []] end end