From 59a37b975c29e6d7f5c8e663ab035cea841cabed Mon Sep 17 00:00:00 2001 From: mappu Date: Wed, 8 Feb 2017 18:57:49 +1300 Subject: [PATCH] more idiomatic error handling --- HubConnection.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/HubConnection.go b/HubConnection.go index 0e2ae94..bc5c121 100644 --- a/HubConnection.go +++ b/HubConnection.go @@ -185,12 +185,13 @@ func (this *HubConnection) processProtocolMessage(message string) { case "$MyINFO": u := UserInfo{} err := u.fromMyINFO(commandParts[1]) - if err == nil { - this.userJoined_Full(&u) - } else { + if err != nil { this.processEvent(HubEvent{EventType: EVENT_DEBUG_MESSAGE, Message: err.Error()}) + return } + this.userJoined_Full(&u) + case "$NickList": nicklist := strings.Split(commandParts[1], "$$") for _, nick := range nicklist {