forked from pothtonswer/discordmuffin
Use json.Unmarshal in event handling so errors are better.
This commit is contained in:
parent
8be21fb539
commit
bf9dda8404
1 changed files with 1 additions and 1 deletions
2
wsapi.go
2
wsapi.go
|
@ -287,7 +287,7 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
|
|
||||||
// Attempt to unmarshal our event.
|
// Attempt to unmarshal our event.
|
||||||
// If there is an error we should handle the event itself.
|
// 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))
|
log.Println(fmt.Sprintf("Unable to unmarshal event %s data: %s", e.Type, err))
|
||||||
// Ready events must fire, even if they are empty.
|
// Ready events must fire, even if they are empty.
|
||||||
if e.Type != "READY" {
|
if e.Type != "READY" {
|
||||||
|
|
Loading…
Reference in a new issue