fix: swallow error if socket has already been closed (#22934)
* Swallow error if socket has already been closed * fix: log error
This commit is contained in:
parent
812b2fff04
commit
f73b470ec0
|
@ -4110,7 +4110,16 @@ export class Connection {
|
||||||
this._rpcWebSocketConnected = false;
|
this._rpcWebSocketConnected = false;
|
||||||
this._rpcWebSocketIdleTimeout = setTimeout(() => {
|
this._rpcWebSocketIdleTimeout = setTimeout(() => {
|
||||||
this._rpcWebSocketIdleTimeout = null;
|
this._rpcWebSocketIdleTimeout = null;
|
||||||
|
try {
|
||||||
this._rpcWebSocket.close();
|
this._rpcWebSocket.close();
|
||||||
|
} catch (err) {
|
||||||
|
// swallow error if socket has already been closed.
|
||||||
|
if (err instanceof Error) {
|
||||||
|
console.log(
|
||||||
|
`Error when closing socket connection: ${err.message}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue