Explorar el Código

Use json.Unmarshal in event handling so errors are better.

Chris Rhodes hace 8 años
padre
commit
bf9dda8404
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      wsapi.go

+ 1 - 1
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" {