Skip to content

post-1.0: add structured error codes to runtime output #277

Closed

Description

@adityamukho

Background

Issue #192 documents user-facing errors in `ERROR_REFERENCE.md` using docs-only reference codes (e.g. `PRS-001`, `STG-002`). This issue tracks the follow-on work to surface those codes at runtime.

Work item

Restructure Minigraf's error handling so that error codes appear in the actual error output seen by users and library consumers.

Currently all errors use `anyhow` with plain string messages. Adding runtime codes requires either:

  • Introducing a typed error enum hierarchy (replacing or wrapping `anyhow`)
  • Or a lightweight wrapper that tags an `anyhow::Error` with a stable code

Acceptance criteria

  • Each user-facing error category (parse, query, storage, WAL, API) has a typed variant or code tag
  • Runtime error output includes the reference code from `ERROR_REFERENCE.md`, e.g. `[PRS-001] Unexpected end of input`
  • Codes are stable across versions (renaming error text does not change the code)
  • Public API surface (db.rs) exposes typed errors so library consumers can match on specific variants
  • `ERROR_REFERENCE.md` codes remain in sync with runtime codes

Dependency

Depends on #192 (error message guide) for the code taxonomy.

Activity

  1. added this to the 2.0 milestone on May 19, 2026
  2. modified the milestones: 2.0, v1.3.0 on Jun 28, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions