diff --git a/src/lib/Client.js b/src/lib/Client.js index d57bb5a..0f0fa1d 100755 --- a/src/lib/Client.js +++ b/src/lib/Client.js @@ -111,10 +111,8 @@ Client.prototype.connect = function() { setTimeout(self.connect.bind(self), ms); }); this.ws.addEventListener("error", function(error) { - console.error(error.toString()); + self.emit("error", error); self.ws.emit("close"); - //self.emit('disconnect', error.toString()); //TODO - //if (error.toString() == "Error: unexpected server response (403)") process.exit(); }); this.ws.addEventListener("open", function(evt) { self.connectionTime = Date.now(); diff --git a/src/mppbridger/index.js b/src/mppbridger/index.js index 5f9f6f4..fe1c41c 100755 --- a/src/mppbridger/index.js +++ b/src/mppbridger/index.js @@ -43,6 +43,7 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site = site == "CMPC" ? new Client("ws://charsy.meowbin.com:16562") : undefined; if (!gClient) return console.error(`Invalid site ${site}`); + gClient.on("error", error => console.error(`[${site}][${room}]`, error.message)) gClient.setChannel(/*(site == "MPP" && room == "lobby") ? "lolwutsecretlobbybackdoor" : */room); gClient.start();