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

Primary indexes specific error messages #206

Open
denyncrawford opened this issue Apr 18, 2024 · 1 comment
Open

Primary indexes specific error messages #206

denyncrawford opened this issue Apr 18, 2024 · 1 comment

Comments

@denyncrawford
Copy link

Would it be possible to enhance the error messages to provide more detailed information about the failing fields during operations? Presently, the error response is limited to:

{
  "error": {
    "ok": false
  }
}

While this is ok for operations with only a few potential failure points, it becomes challenging to pinpoint errors within larger DTOs.

I'm not sure if this is a limitation specific to Deno KV, but it would be great if it could be improved if possible.

@oliver-oloughlin
Copy link
Owner

This is a good point, thanks for raising it. As for right now, I don't see any easy way of implementing more nuanced error messages without making significant sacrifices to performance. The reason is that checking for collisions on unique indices relies on the kv.atomic().check() operation. For multiple indices, there will be multiple check() operations combined together with the set() operation. The result when committing the operation is simply the commit error object { "ok": false } or a commit result with the signature { ok: true, versionstamp: string }. Because KV gives no feedback on which check operation that fails, it doesn't seem possible to me as of now to forward this error response with any more nuance sadly.

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

2 participants