2014-06-18 16:55:49 +04:00
|
|
|
package redis
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-04-04 16:46:57 +03:00
|
|
|
"io"
|
|
|
|
"net"
|
2014-06-18 16:55:49 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Redis nil reply.
|
|
|
|
var Nil = errorf("redis: nil")
|
|
|
|
|
|
|
|
// Redis transaction failed.
|
|
|
|
var TxFailedErr = errorf("redis: transaction failed")
|
|
|
|
|
|
|
|
type redisError struct {
|
|
|
|
s string
|
|
|
|
}
|
|
|
|
|
|
|
|
func errorf(s string, args ...interface{}) redisError {
|
|
|
|
return redisError{s: fmt.Sprintf(s, args...)}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err redisError) Error() string {
|
|
|
|
return err.s
|
|
|
|
}
|
2015-04-04 16:46:57 +03:00
|
|
|
|
|
|
|
func isNetworkError(err error) bool {
|
|
|
|
if _, ok := err.(*net.OpError); ok || err == io.EOF {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|