From ab8593d3cde9c4623b7245c14ccc829cb318d542 Mon Sep 17 00:00:00 2001 From: Alexandre Oliveira Date: Tue, 4 Feb 2020 17:31:55 -0300 Subject: [PATCH] Write prettier error messages for IRC errors --- client/components/MessageTypes/error.vue | 58 ++++++++++++++++++++++++ src/plugins/irc-events/error.js | 20 ++------ 2 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 client/components/MessageTypes/error.vue diff --git a/client/components/MessageTypes/error.vue b/client/components/MessageTypes/error.vue new file mode 100644 index 00000000..0453f10a --- /dev/null +++ b/client/components/MessageTypes/error.vue @@ -0,0 +1,58 @@ + + + diff --git a/src/plugins/irc-events/error.js b/src/plugins/irc-events/error.js index 56c49cfc..9c146502 100644 --- a/src/plugins/irc-events/error.js +++ b/src/plugins/irc-events/error.js @@ -7,24 +7,14 @@ module.exports = function(irc, network) { const client = this; irc.on("irc error", function(data) { - let text = ""; - - if (data.channel) { - text = `${data.channel}: `; - } - - if (data.error === "user_on_channel") { - text += `User (${data.nick}) is already on channel`; - } else if (data.reason) { - text += `${data.reason} (${data.error})`; - } else { - text += data.error; - } - const msg = new Msg({ type: Msg.Type.ERROR, - text: text, + error: data.error, showInActive: true, + nick: data.nick, + channel: data.channel, + reason: data.reason, + command: data.command, }); let target = network.channels[0];