From 9b7309d4c99cd1835feddc027d4576bdc9331f2b Mon Sep 17 00:00:00 2001 From: delthas Date: Wed, 25 Mar 2020 23:56:01 +0100 Subject: [PATCH] Simplify error handling for downstream JOIN/PART downstreamConnection.unmarshalEntity already returns an ircError of command ERR_NOSUCHCHANNEL, so there's no need to explicitly return another ircError of that type. --- downstream.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/downstream.go b/downstream.go index 4e84323..7946477 100644 --- a/downstream.go +++ b/downstream.go @@ -848,10 +848,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error { for i, name := range strings.Split(namesStr, ",") { uc, upstreamName, err := dc.unmarshalEntity(name) if err != nil { - return ircError{&irc.Message{ - Command: irc.ERR_NOSUCHCHANNEL, - Params: []string{name, err.Error()}, - }} + return err } var key string @@ -890,10 +887,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error { for _, name := range strings.Split(namesStr, ",") { uc, upstreamName, err := dc.unmarshalEntity(name) if err != nil { - return ircError{&irc.Message{ - Command: irc.ERR_NOSUCHCHANNEL, - Params: []string{name, err.Error()}, - }} + return err } params := []string{upstreamName}