package redis

import (
	
	
	
	

	
	
)

var ErrClosed = pool.ErrClosed

type Error interface {
	error
RedisError is a no-op function but serves to distinguish types that are Redis errors from ordinary errors: a type is a Redis error if it has a RedisError method.
	RedisError()
}

var _ Error = proto.RedisError("")

func ( error,  bool) bool {
	switch  {
	case io.EOF, io.ErrUnexpectedEOF:
		return true
	case nil, context.Canceled, context.DeadlineExceeded:
		return false
	}

	if ,  := .(timeoutError);  {
		if .Timeout() {
			return 
		}
		return true
	}

	 := .Error()
	if  == "ERR max number of clients reached" {
		return true
	}
	if strings.HasPrefix(, "LOADING ") {
		return true
	}
	if strings.HasPrefix(, "READONLY ") {
		return true
	}
	if strings.HasPrefix(, "CLUSTERDOWN ") {
		return true
	}

	return false
}

func ( error) bool {
	,  := .(proto.RedisError)
	return 
}

func ( error,  bool) bool {
	if  == nil {
		return false
	}

Close connections in read only state in case domain addr is used and domain resolves to a different Redis Server. See #790.
		return isReadOnlyError()
	}

	if  {
		if ,  := .(net.Error);  && .Timeout() {
			return !.Temporary()
		}
	}

	return true
}

func ( error) ( bool,  bool,  string) {
	if !isRedisError() {
		return
	}

	 := .Error()
	switch {
	case strings.HasPrefix(, "MOVED "):
		 = true
	case strings.HasPrefix(, "ASK "):
		 = true
	default:
		return
	}

	 := strings.LastIndex(, " ")
	if  == -1 {
		return false, false, ""
	}
	 = [+1:]
	return
}

func ( error) bool {
	return strings.HasPrefix(.Error(), "LOADING ")
}

func ( error) bool {
	return strings.HasPrefix(.Error(), "READONLY ")
}
------------------------------------------------------------------------------

type timeoutError interface {
	Timeout() bool