forked from lug/matterbridge
Update vendor (#1384)
This commit is contained in:
26
vendor/github.com/slack-go/slack/misc.go
generated
vendored
26
vendor/github.com/slack-go/slack/misc.go
generated
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user