From 0d2feed6c26a7bd6c5458e970afd1f72a21d0dd8 Mon Sep 17 00:00:00 2001 From: Syfaro Date: Mon, 26 Oct 2015 08:02:46 -0500 Subject: [PATCH] fix UploadFile not properly throwing an error when not Ok response --- methods.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/methods.go b/methods.go index c464541..eb42d19 100644 --- a/methods.go +++ b/methods.go @@ -290,6 +290,10 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna var apiResp APIResponse json.Unmarshal(bytes, &apiResp) + if !apiResp.Ok { + return APIResponse{}, errors.New(apiResp.Description) + } + return apiResp, nil }