Merge pull request #300 from yi-jiayu/upload-file-response-parameters

Include ResponseParameters in UploadFile error
bot-api-6.1
Syfaro 2020-07-21 03:14:03 -05:00 committed by GitHub
commit fe3a0a8654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

6
bot.go
View File

@ -245,7 +245,11 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
} }
if !apiResp.Ok { if !apiResp.Ok {
return APIResponse{}, errors.New(apiResp.Description) parameters := ResponseParameters{}
if apiResp.Parameters != nil {
parameters = *apiResp.Parameters
}
return apiResp, Error{Code: apiResp.ErrorCode, Message: apiResp.Description, ResponseParameters: parameters}
} }
return apiResp, nil return apiResp, nil