8 "github.com/go-redis/redis/internal/proto"
11 func IsRetryableError(err error, retryTimeout bool) bool {
18 if netErr, ok := err.(net.Error); ok {
25 if s == "ERR max number of clients reached" {
28 if strings.HasPrefix(s, "LOADING ") {
31 if strings.HasPrefix(s, "READONLY ") {
34 if strings.HasPrefix(s, "CLUSTERDOWN ") {
40 func IsRedisError(err error) bool {
41 _, ok := err.(proto.RedisError)
45 func IsBadConn(err error, allowTimeout bool) bool {
49 if IsRedisError(err) {
51 return IsReadOnlyError(err)
54 if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
61 func IsMovedError(err error) (moved bool, ask bool, addr string) {
62 if !IsRedisError(err) {
67 if strings.HasPrefix(s, "MOVED ") {
69 } else if strings.HasPrefix(s, "ASK ") {
75 ind := strings.LastIndex(s, " ")
77 return false, false, ""
83 func IsLoadingError(err error) bool {
84 return strings.HasPrefix(err.Error(), "LOADING ")
87 func IsReadOnlyError(err error) bool {
88 return strings.HasPrefix(err.Error(), "READONLY ")