3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +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 // send out the message
ircmsg := ircmsg.MakeMessage(tags, prefix, command, params...) message := ircmsg.MakeMessage(tags, prefix, command, params...)
line, err := ircmsg.Line() line, err := message.Line()
if err != nil { 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 return err
} }
client.socket.Write(line) client.socket.Write(line)