specify websocket error as close reason when no message is available.

fixes https://github.com/nbd-wtf/nostr-tools/issues/411
This commit is contained in:
fiatjaf 2024-06-06 15:32:26 -03:00
parent f8c3e20f3d
commit 753ff323ea
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ export class AbstractRelay {
}
this.ws.onerror = ev => {
reject((ev as any).message)
reject((ev as any).message || 'websocket error')
if (this._connected) {
this._connected = false
this.connectionPromise = undefined