Skip to content

Commit

Permalink
fix: log websocket error on graceful close failure (#2072)
Browse files Browse the repository at this point in the history
When gracefully closing a websocket connection fails, log the error
to make debugging easier.
  • Loading branch information
achingbrain committed Sep 23, 2023
1 parent 368ee26 commit 72319fe
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/transport-websockets/src/socket-to-conn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function socketToMaConn (stream: DuplexWebSocket, remoteAddr: Multiaddr,
try {
await stream.close()
} catch (err: any) {
log.error('error closing WebSocket gracefully', err)
this.abort(err)
} finally {
options.signal.removeEventListener('abort', listener)
Expand Down

0 comments on commit 72319fe

Please sign in to comment.