Include ResponseParameters in UploadFile error
This makes UploadFile behave more similarly to MakeRequest when the response is not ok.bot-api-6.1
parent
aa124ef1e8
commit
e0d9306d8b
6
bot.go
6
bot.go
|
@ -226,7 +226,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
|
||||||
|
|
Loading…
Reference in New Issue