timelines.go
changeset 98 5d803adfc57e
parent 94 beee0238a82e
child 118 d9c798e09f0a
--- a/timelines.go	Thu Apr 13 00:00:00 2017 +0200
+++ b/timelines.go	Thu Apr 13 00:17:57 2017 +0200
@@ -34,12 +34,10 @@
 
 	err = json.Unmarshal([]byte(r.Body), &tl)
 	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 tl, fmt.Errorf("%s", res.Error)
+			return tl, fmt.Errorf("%s", errorRes.Text)
 		}
 		return tl, fmt.Errorf("timelines API: %s", err.Error())
 	}