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

Return explicit failure from object store retrieval operations #432

Open
inexorabletash opened this issue Nov 7, 2024 · 1 comment
Open
Assignees
Labels
Milestone

Comments

@inexorabletash
Copy link
Member

As discussed in #430 -

In https://w3c.github.io/IndexedDB/#object-store-retrieval-operation the operation is noted to "return undefined, an ECMAScript value, or an error (a DOMException)"

The problem with this is that DOMException (and JS errors) are Serializable so to the caller it is ambiguous if a stored exception is successfully returned, or if the operation failed and is returning an error.

One simple approach would be to return "success and a value (an ECMAScript value or undefined), or failure and an error (a DOMException)", with specific steps saying e.g. "return success and value" or "return failure and a FooException" and then have the caller operate on "if result is failure" rather than "if result is an error". (We could make this a tuple but I think that's overkill.)

All database operations should be updated to be consistent. For example, in object store storage the phrasing of "... then this operation failed ..." should be updated to explicitly return failure.

@abhishek-shanthkumar or @SteveBeckerMSFT - any interest in putting up a PR for this?

@inexorabletash inexorabletash added this to the V3 milestone Nov 7, 2024
@SteveBeckerMSFT SteveBeckerMSFT self-assigned this Nov 8, 2024
@SteveBeckerMSFT
Copy link

@inexorabletash thanks for the heads up. We will work on a PR for this issue. Assigning to myself.

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

No branches or pull requests

2 participants