From 2bfcc553cea99fc52b90e67d0776b642a92a5159 Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Mon, 19 Sep 2016 23:00:19 +1000 Subject: [PATCH] client: Don't fail silently on error sending messages --- irc/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/irc/client.go b/irc/client.go index c5e38961..7ad84be5 100644 --- a/irc/client.go +++ b/irc/client.go @@ -377,9 +377,13 @@ func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, comm } // send out the message - ircmsg := ircmsg.MakeMessage(tags, prefix, command, params...) - line, err := ircmsg.Line() + message := ircmsg.MakeMessage(tags, prefix, command, params...) + line, err := message.Line() if err != nil { + // try not to fail quietly - especially useful when running tests, as a note to dig deeper + message = ircmsg.MakeMessage(nil, client.server.nameString, ERR_UNKNOWNERROR, "*", "Error assembling message for sending") + line, _ := message.Line() + client.socket.Write(line) return err } client.socket.Write(line)