Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent JSON.OBJLEN: Add error-message for when querying non-existent key #1353

Closed
paulwalrath opened this issue Dec 3, 2024 · 4 comments
Assignees

Comments

@paulwalrath
Copy link
Contributor

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

  1. the implementation for that command is in the evalJSONOBJLEN() function in internal/eval/store_eval.go. Change the EvalResponse object so it returns the diceerrors.ErrKeyDoesNotExist error, instead of nil.
  2. modify test cases in integration_tests for this change.
@akhilk2802
Copy link

Hi @paulwalrat, are you still working on this ? would love to start with this

@paulwalrath
Copy link
Contributor Author

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.

@akhilk2802
Copy link

Got it

@lucifercr07
Copy link
Contributor

Closing, merged as part of #1354.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants