From 5d938afef265c5387f14d416fdf94fb5dea9b379 Mon Sep 17 00:00:00 2001 From: DeziderMesko Date: Mon, 31 Jul 2017 21:24:49 +0200 Subject: [PATCH] fixed error return value (#32) --- response.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/response.go b/response.go index 92726f3..60675da 100644 --- a/response.go +++ b/response.go @@ -50,9 +50,10 @@ func checkFacebookError(r io.Reader) error { err = json.NewDecoder(r).Decode(&qr) if qr.Error != nil { err = fmt.Errorf("Facebook error : %s", qr.Error.Message) + return err } - return err + return nil } // Response is used for responding to events with messages. @@ -151,9 +152,7 @@ func (r *Response) AttachmentData(dataType AttachmentType, filename string, file return err } - var res bytes.Buffer - res.ReadFrom(resp.Body) - return nil + return checkFacebookError(resp.Body) } // ButtonTemplate sends a message with the main contents being button elements