- From: Joshua Bell <notifications@github.com>
- Date: Thu, 07 Nov 2024 12:36:47 -0800
- To: w3c/IndexedDB <IndexedDB@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/IndexedDB/issues/432@github.com>
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](https://webidl.spec.whatwg.org/#idl-DOMException) so to [the caller](https://w3c.github.io/IndexedDB/#async-execute-request) 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](https://infra.spec.whatwg.org/#tuples) but I think that's overkill.) All [database operations](https://w3c.github.io/IndexedDB/#database-operations) should be updated to be consistent. For example, in [object store storage](https://w3c.github.io/IndexedDB/#object-store-storage-operation) 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? -- Reply to this email directly or view it on GitHub: https://github.com/w3c/IndexedDB/issues/432 You are receiving this because you are subscribed to this thread. Message ID: <w3c/IndexedDB/issues/432@github.com>
Received on Thursday, 7 November 2024 20:36:51 UTC