forked from mirror/ledisdb
modify error msg
This commit is contained in:
parent
a6a760880d
commit
3f3ca8da63
|
@ -8,13 +8,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ERR_ARGUMENT_FORMAT = "ERR wrong number of arguments for '%s' command"
|
ERR_ARGUMENT_FORMAT = "wrong number of arguments for '%s' command"
|
||||||
MSG_OK = "OK"
|
MSG_OK = "OK"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrValue = errors.New("ERR value is not an integer or out of range")
|
ErrValue = errors.New("value is not an integer or out of range")
|
||||||
ErrSyntax = errors.New("ERR syntax error")
|
ErrSyntax = errors.New("syntax error")
|
||||||
)
|
)
|
||||||
|
|
||||||
type commondFunc func(*ledis.DB, ...string) (interface{}, error)
|
type commondFunc func(*ledis.DB, ...string) (interface{}, error)
|
||||||
|
|
|
@ -288,8 +288,15 @@ func zrangeGeneric(db *ledis.DB, reverse bool, args ...string) (interface{}, err
|
||||||
args = args[3:]
|
args = args[3:]
|
||||||
var withScores bool = false
|
var withScores bool = false
|
||||||
|
|
||||||
if len(args) > 0 && strings.ToLower(args[0]) == "withscores" {
|
if len(args) > 0 {
|
||||||
withScores = true
|
if len(args) != 1 {
|
||||||
|
return nil, ErrSyntax
|
||||||
|
}
|
||||||
|
if strings.ToLower(args[0]) == "withscores" {
|
||||||
|
withScores = true
|
||||||
|
} else {
|
||||||
|
return nil, ErrSyntax
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if datas, err := db.ZRangeGeneric(key, start, stop, reverse); err != nil {
|
if datas, err := db.ZRangeGeneric(key, start, stop, reverse); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue