Handle upstream ERROR messages

This commit is contained in:
Simon Ser 2020-08-13 15:30:41 +02:00
parent 9fd69c745e
commit 0831dbe6f1
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 6 additions and 0 deletions

View File

@ -1343,6 +1343,12 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
// Ignore
case irc.RPL_STATSVLINE, rpl_statsping, irc.RPL_STATSBLINE, irc.RPL_STATSDLINE:
// Ignore
case "ERROR":
var text string
if err := parseMessageParams(msg, &text); err != nil {
return err
}
return fmt.Errorf("fatal server error: %v", text)
case irc.ERR_PASSWDMISMATCH, irc.ERR_ERRONEUSNICKNAME, irc.ERR_NICKNAMEINUSE, irc.ERR_NICKCOLLISION, irc.ERR_UNAVAILRESOURCE, irc.ERR_NOPERMFORHOST, irc.ERR_YOUREBANNEDCREEP:
if !uc.registered {
return fmt.Errorf("registration failed: %v", msg.Params[len(msg.Params)-1])