Skip to content

BrowserDb errors have no error code #673

Closed

Description

@adityamukho

BrowserDb (the browser feature, published as @minigraf/browser) rejects with the error's top-level message only, without the structured code that every other API carries:

await db.execute('(nosuchcommand [])')
// rejects with "Unknown command: nosuchcommand"
// the native API, the WASI REPL and the other bindings report "[PRS-…] Unknown command: nosuchcommand"

Cause: src/browser/mod.rs converts errors with JsValue::from_str(&e.to_string()) (12 places on main, 15 on v3), which formats the anyhow::Error without its code. Only the IndexedDB flush path goes through MinigrafError::from(e). Since #277 (v2.0.0), every error is supposed to carry its code (docs/ERROR_REFERENCE.md).

Fix: route every conversion through one helper, MinigrafError::from(e).to_string(), and add a wasm_bindgen_test that checks for the [XXX-NNN] prefix. Fix it on v3 first, then backport to main for v2.0.9.

Found by the minigraf-wasm consumer test (binding consumer tests plan, docs/superpowers/plans/2026-10-20-binding-consumer-tests.md).

🤖 Generated with Claude Code

Activity

  1. added 3 commits that reference this issue on Oct 21, 2026
  2. adityamukho commented on Oct 21, 2026

    @adityamukho
    CollaboratorAuthor

    Fixed in v2.0.9 (#677) and on v3 (#675).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions