~emersion/gamja

3536331f94dd38890be77f7ae2304561107c7bc5 — Simon Ser a month ago 8a5fa4d
lib/client: throw error in send if disconnected
1 files changed, 3 insertions(+), 0 deletions(-)

M lib/client.js
M lib/client.js => lib/client.js +3 -0
@@ 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);
	}