diff options
author | Wim <wim@42.be> | 2021-02-01 21:29:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 21:29:04 +0100 |
commit | 0452be0cb383ff560e340b643b60a35c6e228639 (patch) | |
tree | 41b91af43c2e321d6498a6b56594b1d0c71c516e /vendor/github.com/slack-go/slack/misc.go | |
parent | 1624f107739b8ed7b142732430e5295764388de2 (diff) | |
download | matterbridge-msglm-0452be0cb383ff560e340b643b60a35c6e228639.tar.gz matterbridge-msglm-0452be0cb383ff560e340b643b60a35c6e228639.tar.bz2 matterbridge-msglm-0452be0cb383ff560e340b643b60a35c6e228639.zip |
Update vendor (#1384)
Diffstat (limited to 'vendor/github.com/slack-go/slack/misc.go')
-rw-r--r-- | vendor/github.com/slack-go/slack/misc.go | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/vendor/github.com/slack-go/slack/misc.go b/vendor/github.com/slack-go/slack/misc.go index 336f0afb..821bda86 100644 --- a/vendor/github.com/slack-go/slack/misc.go +++ b/vendor/github.com/slack-go/slack/misc.go @@ -18,6 +18,8 @@ import ( "strconv" "strings" "time" + + "github.com/slack-go/slack/internal/misc" ) // SlackResponse handles parsing out errors from the web api. @@ -42,28 +44,6 @@ func (t SlackResponse) Err() error { return errors.New(t.Error) } -// StatusCodeError represents an http response error. -// type httpStatusCode interface { HTTPStatusCode() int } to handle it. -type statusCodeError struct { - Code int - Status string -} - -func (t statusCodeError) Error() string { - return fmt.Sprintf("slack server error: %s", t.Status) -} - -func (t statusCodeError) HTTPStatusCode() int { - return t.Code -} - -func (t statusCodeError) Retryable() bool { - if t.Code >= 500 || t.Code == http.StatusTooManyRequests { - return true - } - return false -} - // RateLimitedError represents the rate limit respond from slack type RateLimitedError struct { RetryAfter time.Duration @@ -312,7 +292,7 @@ func checkStatusCode(resp *http.Response, d Debug) error { // Slack seems to send an HTML body along with 5xx error codes. Don't parse it. if resp.StatusCode != http.StatusOK { logResponse(resp, d) - return statusCodeError{Code: resp.StatusCode, Status: resp.Status} + return misc.StatusCodeError{Code: resp.StatusCode, Status: resp.Status} } return nil |