blob: 7347137aa685081766c2ed86091c6965e202be25 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package slack
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
}
|