From bf9dda84049a5894bb2f392e8ad200a2b1342e42 Mon Sep 17 00:00:00 2001 From: Chris Rhodes Date: Sat, 23 Apr 2016 11:58:19 -0700 Subject: [PATCH] Use json.Unmarshal in event handling so errors are better. --- wsapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wsapi.go b/wsapi.go index 3d1da3e..bf060ba 100644 --- a/wsapi.go +++ b/wsapi.go @@ -287,7 +287,7 @@ func (s *Session) event(messageType int, message []byte) { // Attempt to unmarshal our event. // If there is an error we should handle the event itself. - if err = unmarshal(e.RawData, i); err != nil { + if err = json.Unmarshal(e.RawData, i); err != nil { log.Println(fmt.Sprintf("Unable to unmarshal event %s data: %s", e.Type, err)) // Ready events must fire, even if they are empty. if e.Type != "READY" {