fix UploadFile not properly throwing an error when not Ok response

bot-api-6.1
Syfaro 2015-10-26 08:02:46 -05:00
parent e1a0a819c0
commit 0d2feed6c2
1 changed files with 4 additions and 0 deletions

View File

@ -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
}