Inconsistent `JSON.OBJLEN`: Add error-message for when querying non-existent key
Steps to reproduce
When I was writing the documentation for the JSON.OBJLEN command, I made it to be similar to the JSON.OBJKEYS command, which is very similar.
But while investigating, I discovered an inconsistency in the JSON.OBJLEN command; it doesn't return an error message when you use it to query a non-existent key.
To reproduce, try running the JSON.OBJLEN command on a key that you know does not exist in the datastore. You will get a blank response. But it should return an error message saying the key does not exist.
Expected output
If you use the command to query a key that doesn't exist, it should give an error:
dicedb> JSON.OBJLEN nonexistent_key $
(error) ERR could not perform this operation on a key that doesn't exist
Observed output
Presently, it does not return an error:
dicedb> JSON.OBJLEN nonexistent_key $
Error: redis: nil
Expectations for resolution
This issue will be considered resolved when the following things are done
- the implementation for that command is in the
evalJSONOBJLEN()function ininternal/eval/store_eval.go. Change the EvalResponse object so it returns thediceerrors.ErrKeyDoesNotExisterror, instead ofnil. - modify test cases in
integration_testsfor this change.
Hi @paulwalrat, are you still working on this ? would love to start with this
Hi @paulwalrat, are you still working on this ? would love to start with this
Hi there. Sorry, there's nothing to do. The work is already done (see PR 1354) and is waiting to be merged.
Got it
Closing, merged as part of https://github.com/DiceDB/dice/pull/1354.