mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2026-10-05 14:38:23 +00:00
reject promise on WebSocket initiation failure.
This commit is contained in:
@@ -85,7 +85,11 @@ export function relayInit(
|
||||
|
||||
async function connectRelay(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
ws = new WebSocket(url)
|
||||
try {
|
||||
ws = new WebSocket(url)
|
||||
} catch (err) {
|
||||
reject(err)
|
||||
}
|
||||
|
||||
ws.onopen = () => {
|
||||
listeners.connect.forEach(cb => cb())
|
||||
|
||||
Reference in New Issue
Block a user