Surface actual IDB errors instead of raw error events#81
Open
mlaw- wants to merge 4 commits intomicrosoft:masterfrom
Open
Surface actual IDB errors instead of raw error events#81mlaw- wants to merge 4 commits intomicrosoft:masterfrom
mlaw- wants to merge 4 commits intomicrosoft:masterfrom
Conversation
eliranek1
previously approved these changes
Apr 3, 2026
eliranek1
previously approved these changes
Apr 3, 2026
thomastay
requested changes
Apr 7, 2026
thomastay
reviewed
Apr 10, 2026
| history.join(",") | ||
| this._trans.error ?? | ||
| new Error( | ||
| "IndexedDbTransaction Aborted, History: " + history.join(",") |
Contributor
There was a problem hiding this comment.
I don't see the this._trans.error.name here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, when an IndexedDB operation failed, callers received the raw
IDBRequest error event rather than the underlying DOMException. This made
error type detection awkward — callers had to navigate err.target.error.name
instead of simply checking err.name or err instanceof DOMException.
Changes
WrapRequest — rejects with req.error (the DOMException) instead of the raw
event. Falls back to the event only if req.error is null.
Transaction onerror/onabort — passes this._trans.error directly to
transactionFailed rather than building a string from it, so the real
DOMException propagates through the transaction's completion promise.
TransactionLockHelper.transactionFailed — accepts string | Error so typed
error objects pass through unchanged.
open() error handler — updated to work with the DOMException directly:
VersionError detection uses
err instanceof DOMException && err.name === "VersionError"instead of inspecting event properties; UpgradeCallback errorfields now populate from err.name/err.message.
Result
Callers can now detect specific IDB errors:
try {
await transaction.put("store", item);
} catch (err) {
if (err instanceof DOMException && err.name === "QuotaExceededError") {
// handle quota exceeded
}
}
Tests