summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/misc.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/slack-go/slack/misc.go')
-rw-r--r--vendor/github.com/slack-go/slack/misc.go26
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