Repository navigation
fix(browser): BrowserDb errors carry their error code (#673) - #675
Merged
Merged
Conversation
BrowserDb rejected with the anyhow error's top-level message only
("Unknown command: nosuchcommand"), so the browser API was the one API
without structured codes. Every anyhow conversion now goes through
to_js_error (MinigrafError::from), so a rejection starts with its code, as
on every other API. A browser test checks a parse, query and transact error.
Found by the minigraf-wasm consumer test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…odes # Conflicts: # CHANGELOG.md
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.
Fixes #673 on
v3. The backport tomain(for v2.0.9) follows as a separate PR.BrowserDbconverted errors withJsValue::from_str(&e.to_string()), which formats ananyhow::Errorwithout its code. So the browser API rejected withUnknown command: nosuchcommandwhere every other API says[PRS-001] Unknown command: nosuchcommand.src/browser/mod.rs(14 sites) now uses the existingto_js_error(MinigrafError::from(e).to_string()).BrowserCursor::nextBatchalready got aMinigrafError, so it keepsto_string(), which includes the code.#[wasm_bindgen_test]execute_errors_carry_their_code: a parse error, a query error and a transact error each reject with a string that starts with[XXX-NNN]. It fails without the fix (checked locally in headless Firefox: 33 passed, 1 failed) and passes with it (34 passed).no window object,IndexedDB not available, an import blob whose length isn't a multiple of the page size, "database is too large to export"). Giving them codes means new registry entries; that's for a separate issue if wanted.Found by the minigraf-wasm consumer test (minigraf-wasm#7). Its browser contract will require the code once the pinned core has this fix.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz