Skip to content

ref(service): Replace Error with anyhow-like struct with embedded kind#547

Draft
lcian wants to merge 10 commits into
mainfrom
lcian/refactor-service-error
Draft

ref(service): Replace Error with anyhow-like struct with embedded kind#547
lcian wants to merge 10 commits into
mainfrom
lcian/refactor-service-error

Conversation

@lcian

@lcian lcian commented Jul 9, 2026

Copy link
Copy Markdown
Member

Replaces the objectstore_service::error::Error enum (which had a variant per failure source — Io, Reqwest, Serde, BackendResponse, GcpAuth, etc.) with an anyhow-shaped Error struct that carries an ErrorKind classification, an optional boxed source error, and an optional context message.

This separates error classification from error origin: backends no longer need to choose between increasingly many enum variants, and the API layer maps a flat ErrorKind to HTTP status codes instead of matching deeply nested enum variants.
The new ErrorKind enum captures the cause of a failure independent of HTTP semantics (ClientStream, InvalidInput, RangeNotSatisfiable, AtCapacity, BackendRateLimited, BackendTimeout, BackendUnavailable, NotImplemented, Internal)

Foreign errors convert via From impls into ErrorKind::Internal with the original as source; the ResultExt trait provides .kind() and .context() to reclassify or annotate without map_err boilerplate.

Closes FS-358

@codecov

This comment has been minimized.

@lcian lcian changed the title wip ref(service): Change service Error to an anyhow-like struct with attached kind Jul 13, 2026
@linear-code

linear-code Bot commented Jul 13, 2026

Copy link
Copy Markdown

FS-358

@lcian lcian changed the title ref(service): Change service Error to an anyhow-like struct with attached kind ref(service): Replace Error enum with anyhow-like Error struct + ErrorKind Jul 13, 2026
@lcian lcian changed the title ref(service): Replace Error enum with anyhow-like Error struct + ErrorKind ref(service): Replace Error enum with anyhow-like Error struct + kind Jul 13, 2026
@lcian lcian changed the title ref(service): Replace Error enum with anyhow-like Error struct + kind ref(service): Replace Error with anyhow-like struct with embedded kind Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant