From 0452be0cb383ff560e340b643b60a35c6e228639 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 1 Feb 2021 21:29:04 +0100 Subject: Update vendor (#1384) --- .../slack-go/slack/internal/misc/misc.go | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 vendor/github.com/slack-go/slack/internal/misc/misc.go (limited to 'vendor/github.com/slack-go/slack/internal/misc/misc.go') diff --git a/vendor/github.com/slack-go/slack/internal/misc/misc.go b/vendor/github.com/slack-go/slack/internal/misc/misc.go new file mode 100644 index 00000000..eab8cdd8 --- /dev/null +++ b/vendor/github.com/slack-go/slack/internal/misc/misc.go @@ -0,0 +1,28 @@ +package misc + +import ( + "fmt" + "net/http" +) + +// 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 +} -- cgit v1.2.3