Catch relay connect errors

This commit is contained in:
Kieran 2023-01-06 14:59:59 +00:00
parent af5758e522
commit 274f400c7a
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -15,12 +15,16 @@ export class NostrSystem {
* @param {string} address
*/
ConnectToRelay(address, options) {
if (typeof this.Sockets[address] === "undefined") {
let c = new Connection(address, options);
for (let s of Object.values(this.Subscriptions)) {
c.AddSubscription(s);
try {
if (typeof this.Sockets[address] === "undefined") {
let c = new Connection(address, options);
for (let s of Object.values(this.Subscriptions)) {
c.AddSubscription(s);
}
this.Sockets[address] = c;
}
this.Sockets[address] = c;
} catch (e) {
console.error(e);
}
}