Context
Deferred from the v0.3.0 bundle (Follow-up D in the four #70 follow-ups). The public hyperdb_api::Error was flattened in #70 per the Microsoft Pragmatic Rust Guidelines (M-ERRORS-CANONICAL-STRUCTS, M-ERRORS-AVOID-WRAPPING-AND-AS-DYN). The internal hyperdb_api_core::client::Error type still uses the older struct-with-kind shape.
Why deferred
client::Error is internal — not re-exported from hyperdb-api, no public callers. The benefit of flattening it is purely codebase-internal hygiene; v0.3.0 ships with all user-facing error improvements without it.
Scope is non-trivial:
- ~51 producer call sites in
hyperdb-api-core/src/client/{client,async_client,connection,grpc/*,tls}.rs
- 15
ErrorKind variants: Connection, Authentication, Query, Protocol, Io, Config, Timeout, Cancelled, Closed, Conversion, FeatureNotSupported, InvalidData, InvalidInput, UnexpectedEof, Other
- Touches the
From<client::Error> for hyperdb_api::Error mapping (currently exhaustive over ErrorKind — must be updated to match against the new flat shape)
Plan: ship as a chore: PR in v0.3.x. No public API change; mechanical migration mirroring #70's pattern.
Approach
Same shape as #70 applied to the internal type:
- Define a flat
client::Error enum, one variant per current ErrorKind variant. Use thiserror. No Box<dyn StdError> cause channel.
- Add ergonomic snake_case constructors taking
impl Into<String> for every variant.
- Sweep the ~51 producer sites file-by-file using a per-call-site mapping table.
- Update the
From<client::Error> for hyperdb_api::Error impl in hyperdb-api/src/error.rs to match against the new flat shape.
- Verify
cargo build/clippy/test/doc clean across the workspace.
Acceptance criteria
References
Context
Deferred from the v0.3.0 bundle (Follow-up D in the four #70 follow-ups). The public
hyperdb_api::Errorwas flattened in #70 per the Microsoft Pragmatic Rust Guidelines (M-ERRORS-CANONICAL-STRUCTS, M-ERRORS-AVOID-WRAPPING-AND-AS-DYN). The internalhyperdb_api_core::client::Errortype still uses the older struct-with-kind shape.Why deferred
client::Erroris internal — not re-exported fromhyperdb-api, no public callers. The benefit of flattening it is purely codebase-internal hygiene; v0.3.0 ships with all user-facing error improvements without it.Scope is non-trivial:
hyperdb-api-core/src/client/{client,async_client,connection,grpc/*,tls}.rsErrorKindvariants:Connection,Authentication,Query,Protocol,Io,Config,Timeout,Cancelled,Closed,Conversion,FeatureNotSupported,InvalidData,InvalidInput,UnexpectedEof,OtherFrom<client::Error> for hyperdb_api::Errormapping (currently exhaustive overErrorKind— must be updated to match against the new flat shape)Plan: ship as a
chore:PR in v0.3.x. No public API change; mechanical migration mirroring #70's pattern.Approach
Same shape as #70 applied to the internal type:
client::Errorenum, one variant per currentErrorKindvariant. Usethiserror. NoBox<dyn StdError>cause channel.impl Into<String>for every variant.From<client::Error> for hyperdb_api::Errorimpl inhyperdb-api/src/error.rsto match against the new flat shape.cargo build/clippy/test/docclean across the workspace.Acceptance criteria
client::Erroris a flat#[non_exhaustive]enum with noBox<dyn>cause channelimpl Into<String>constructorFrom<client::Error> for hyperdb_api::Errormapping is updated and exhaustivecargo build --workspace --all-targetscleancargo clippy --workspace --all-targets -- -D warningscleancargo test --workspace(full, including doctests) greencargo doc --workspace --no-depswarning count ≤ baselineclient::Error/client::ErrorKind— currently zero)References
MIGRATING-0.3.md