3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 03:02:48 +01:00

client: Don't fail silently on error sending messages

This commit is contained in:
Daniel Oaks 2016-09-19 23:00:19 +10:00
parent dc0f679723
commit 2bfcc553ce

View File

@ -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)