forked from mirror/ledisdb
modify error msg
This commit is contained in:
parent
a6a760880d
commit
3f3ca8da63
|
@ -8,13 +8,13 @@ import (
|
|||
)
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrValue = errors.New("ERR value is not an integer or out of range")
|
||||
ErrSyntax = errors.New("ERR syntax error")
|
||||
ErrValue = errors.New("value is not an integer or out of range")
|
||||
ErrSyntax = errors.New("syntax 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:]
|
||||
var withScores bool = false
|
||||
|
||||
if len(args) > 0 && strings.ToLower(args[0]) == "withscores" {
|
||||
if len(args) > 0 {
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue