diff -r 1d5879af2556 -r 5d803adfc57e notifications.go --- a/notifications.go Thu Apr 13 00:00:00 2017 +0200 +++ b/notifications.go Thu Apr 13 00:17:57 2017 +0200 @@ -20,12 +20,10 @@ err = json.Unmarshal([]byte(r.Body), ¬ifications) if err != nil { - var res struct { - Error string `json:"error"` - } - err2 := json.Unmarshal([]byte(r.Body), &res) + var errorRes Error + err2 := json.Unmarshal([]byte(r.Body), &errorRes) if err2 == nil { - return notifications, fmt.Errorf("%s", res.Error) + return notifications, fmt.Errorf("%s", errorRes.Text) } return notifications, fmt.Errorf("notifications API: %s", err.Error()) } @@ -45,12 +43,10 @@ err = json.Unmarshal([]byte(r.Body), ¬ification) if err != nil { - var res struct { - Error string `json:"error"` - } - err2 := json.Unmarshal([]byte(r.Body), &res) + var errorRes Error + err2 := json.Unmarshal([]byte(r.Body), &errorRes) if err2 == nil { - return ¬ification, fmt.Errorf("%s", res.Error) + return ¬ification, fmt.Errorf("%s", errorRes.Text) } return ¬ification, fmt.Errorf("notification API: %s", err.Error()) }