Skip to content

Commit

Permalink
use internal error constants
Browse files Browse the repository at this point in the history
  • Loading branch information
xanish committed Oct 20, 2024
1 parent e33e207 commit 116fec4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions internal/errors/migrated_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var (
ErrOverflow = errors.New("ERR increment or decrement would overflow") // Signifies that an increment or decrement operation would exceed the limits.
ErrSyntax = errors.New("ERR syntax error") // Represents a syntax error in a DiceDB command.
ErrKeyNotFound = errors.New("ERR no such key") // Indicates that the specified key does not exist.
ErrUnableToFetchKeys = errors.New("ERR unable to fetch keys from store") // Indicates that the specified key does not exist.
ErrWrongTypeOperation = errors.New("WRONGTYPE Operation against a key holding the wrong kind of value") // Signals an operation attempted on a key with an incompatible type.
ErrInvalidHyperLogLogKey = errors.New("WRONGTYPE Key is not a valid HyperLogLog string value") // Indicates that a key is not a valid HyperLogLog value.
ErrCorruptedHyperLogLogObject = errors.New("INVALIDOBJ Corrupted HLL object detected") // Signals detection of a corrupted HyperLogLog object.
Expand Down
4 changes: 1 addition & 3 deletions internal/eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -3921,7 +3921,6 @@ func evalSINTER(args []string, store *dstore.Store) []byte {
return clientio.Encode(members, false)
}


func evalHLEN(args []string, store *dstore.Store) []byte {
if len(args) != 1 {
return diceerrors.NewErrArity("HLEN")
Expand Down Expand Up @@ -4818,8 +4817,7 @@ func evalRANDOMKEY(args []string, store *dstore.Store) *EvalResponse {

availKeys, err := store.Keys("*")
if err != nil {
return &EvalResponse{Result: nil,
Error: errors.New(string(diceerrors.NewErrWithMessage("could not fetch keys to extract a random key")))}
return &EvalResponse{Result: nil, Error: diceerrors.ErrUnableToFetchKeys}
}

if len(availKeys) > 0 {
Expand Down

0 comments on commit 116fec4

Please sign in to comment.