1
0
mirror of https://github.com/redis/go-redis.git synced 2025-04-19 07:22:17 +03:00
go-redis/error.go
2015-04-07 12:51:01 +03:00

33 lines
509 B
Go

package redis
import (
"fmt"
"io"
"net"
)
// 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
}
func isNetworkError(err error) bool {
if _, ok := err.(*net.OpError); ok || err == io.EOF {
return true
}
return false
}