Log WebSocket constructor error in the console

This commit is contained in:
Simon Ser 2021-01-22 20:59:17 +01:00
parent 987f0b3389
commit 1f640a4010

View File

@ -59,6 +59,7 @@ export default class Client extends EventTarget {
try {
this.ws = new WebSocket(this.params.url);
} catch (err) {
console.error("Failed to create connection:", err);
setTimeout(() => {
this.dispatchEvent(new CustomEvent("error", { detail: "Failed to create connection: " + err }));
this.setStatus(Client.Status.DISCONNECTED);