Skip to content

[P3][kernel] Design typed error contract for public API failures #28

Closed

Description

@cevheri

Summary

All failures surface as bare Error with libredb: prefix strings. Callers must match message text — fragile for a public API surface about to lock.

Audit ID: Section 4 Low — Wave 3 roadmap

Proposal

Design a small typed error taxonomy before API is public-locked:

export class LibreDbError extends Error {
  readonly code: "CLOSED" | "NESTED_TX" | "CORRUPT_WAL" | ...;
}

Or discriminated union on cause — research SQLite/libSQL patterns.

Deliverable

  1. Design note: codes list, stability promise, migration from string matching.
  2. Implement incrementally starting with kernel errors.

Acceptance criteria

  • Design agreed in issue or short doc PR.
  • At least kernel hot paths use stable code.
  • Changeset required when exported.

Non-goals

  • Full i18n; English messages remain.

Related

  • EBADF-on-close issue (subset of codes).

Activity

  1. cevheri commented on Jul 3, 2026

    @cevheri
    MemberAuthor

    Implemented and shipped in PR #43 (merge commit 69f7161), released as v0.2.0. The PR description's comma-separated Closes list only auto-closed the first reference — closing manually. For #39/#28-style partials: the shipped scope is done; the real-browser verification half of #39 continues under #10, and the typed-error contract (#28) shipped as LibreDbError with stable codes across kernel, adapters, lenses, and CLI.

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions