some small bugs codebuff found.

This commit is contained in:
fiatjaf
2025-04-03 23:31:34 -03:00
parent ba26b92973
commit dd603e47d8
3 changed files with 18 additions and 9 deletions

View File

@@ -90,6 +90,7 @@ export class AbstractRelay {
try {
this.ws = new this._WebSocket(this.url)
} catch (err) {
clearTimeout(this.connectionTimeoutHandle)
reject(err)
return
}
@@ -101,6 +102,7 @@ export class AbstractRelay {
}
this.ws.onerror = ev => {
clearTimeout(this.connectionTimeoutHandle)
reject((ev as any).message || 'websocket error')
if (this._connected) {
this._connected = false