mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
Better error message when request is canceled
This commit is contained in:
@ -2,6 +2,11 @@
|
||||
|
||||
Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
## unreleased
|
||||
|
||||
### Changed
|
||||
* GODT-308 better user error message when request is canceled
|
||||
|
||||
## [v1.2.7] Donghai-hotfix - beta (2020-05-07)
|
||||
|
||||
### Added
|
||||
|
||||
@ -56,6 +56,7 @@ var (
|
||||
ErrInvalidToken = errors.New("refresh token invalid")
|
||||
ErrAPINotReachable = errors.New("cannot reach the server")
|
||||
ErrUpgradeApplication = errors.New("application upgrade required")
|
||||
ErrConnectionSlow = errors.New("request canceled because connection speed was too slow")
|
||||
)
|
||||
|
||||
type ErrUnprocessableEntity struct {
|
||||
@ -345,6 +346,9 @@ func (c *client) doJSONBuffered(req *http.Request, reqBodyBuffer []byte, data in
|
||||
resBody, err = ioutil.ReadAll(res.Body)
|
||||
} else {
|
||||
resBody, err = c.readAllMinSpeed(res.Body, cancelRequest)
|
||||
if err == context.Canceled {
|
||||
err = ErrConnectionSlow
|
||||
}
|
||||
}
|
||||
|
||||
// The server response may contain data which we want to have in memory
|
||||
|
||||
Reference in New Issue
Block a user