modify error msg

This commit is contained in:
wenyekui 2014-07-24 11:41:53 +08:00
parent a6a760880d
commit 3f3ca8da63
2 changed files with 12 additions and 5 deletions

View File

@ -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)

View File

@ -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" {
withScores = true
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 {