Update vendor (#1384)

This commit is contained in:
Wim
2021-02-01 21:29:04 +01:00
committed by GitHub
parent 1624f10773
commit 0452be0cb3
37 changed files with 1539 additions and 244 deletions

View File

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