From 1b97c1031d806cd928564935d37609479ab49cfb Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 23 Feb 2018 20:05:19 +0200 Subject: [PATCH] Log socket close error if any --- src/plugins/irc-events/connection.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/irc-events/connection.js b/src/plugins/irc-events/connection.js index fb93b7fb..926d1304 100644 --- a/src/plugins/irc-events/connection.js +++ b/src/plugins/irc-events/connection.js @@ -78,7 +78,7 @@ module.exports = function(irc, network) { identSocketId = client.manager.identHandler.addSocket(socket, client.name || network.username); }); - irc.on("socket close", function() { + irc.on("socket close", function(error) { if (identSocketId > 0) { client.manager.identHandler.removeSocket(identSocketId); identSocketId = 0; @@ -88,6 +88,13 @@ module.exports = function(irc, network) { chan.state = Chan.State.PARTED; }); + if (error) { + network.channels[0].pushMessage(client, new Msg({ + type: Msg.Type.ERROR, + text: `Connection closed unexpectedly: ${error}`, + }), true); + } + sendStatus(); });