Skip to content

Binder: RequestBindingError has no public members, forcing consumers to magic strings #147

Description

@Reefact

Review finding 11/19 · conventional-comment issue · area binder · gate: decide before the v1 API freeze
To add once they exist: label binder; milestone v1. (Already applied: bug.)

Problem

RequestBindingError is a public static class, but its factories (ArgumentRequired, ArgumentInvalid) are internal and its error codes live in a private static class Code. The type therefore exposes no member a consumer can reference.

Impact

A consumer that needs to branch on the binder's structural codes (REQUEST_ARGUMENT_REQUIRED, REQUEST_ARGUMENT_INVALID) — for example to map them to an HTTP response — can only compare magic strings, which is exactly what the library's coded-error model exists to avoid.

Direction

Expose a small public surface for the two codes: public ErrorCode constants, or predicates such as IsRequestArgumentRequired(error) / IsRequestArgumentInvalid(error), so consumers reference them symbolically. Decide the shape before the v1 freeze.

Context

Surfaced by the RequestBinder review (design spec #126, shipped in #141). Finding 11 of 19.
Related: #140 (surfacing these codes in a consumer's generated catalog).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions