diff --git a/lib/client.js b/lib/client.js index eab180d..f567c8f 100644 --- a/lib/client.js +++ b/lib/client.js @@ -341,6 +341,9 @@ export default class Client extends EventTarget { } send(msg) { + if (!this.ws) { + throw new Error("Failed to send IRC message " + msg.command + ": socket is closed"); + } this.ws.send(irc.formatMessage(msg)); console.log("Sent:", msg); }