2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-17 03:26:07 +00:00
matterbridge/vendor/github.com/slack-go/slack/status_code_error.go

29 lines
536 B
Go
Raw Normal View History

2022-06-24 22:36:16 +00:00
package slack
2021-02-01 20:29:04 +00:00
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
}