feat(rust): add uniform API call errors - #141
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
adamcavendish
force-pushed
the
adamcavendish/rust-uniform-api-call-error
branch
from
July 31, 2026 12:13
10fc6b9 to
7b619a5
Compare
- Preserve operation-specific typed errors while converting each into ApiCallError - Retain operation IDs, status, native headers, raw bodies, and error sources - Document and compile-test direct ?, thiserror, and SNAFU integration - Emit uniform error machinery only for operation-bearing SDKs - Regenerate and compile-check reqwest, ureq, and aioduct clients
adamcavendish
force-pushed
the
adamcavendish/rust-uniform-api-call-error
branch
from
July 31, 2026 13:08
7b619a5 to
3ec813f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a common
ApiCallErrorto generated Rust clients that contain operations while preserving the existing operation-specific typed error enums. Generated conversions allow multi-operation workflows to use direct?propagation without requiringanyhow.Problem
Operation-specific errors preserve precise response payload types, but a workflow that calls several generated operations cannot name one ordinary error type. Applications using
thiserroror SNAFU otherwise need to enumerate every generated error or map every call manually.Behavior
ApiError<T>bodyResult<_, ApiCallError>and propagate each operation error directly with?std::error::Error::source()thiserroror SNAFUApiCallError; model-only clients remain warning-cleanCompatibility
This is additive for operation-bearing
rust-reqwest,rust-ureq, andrust-aioductclients: generated operation signatures and typed error enums remain unchanged. Converting intoApiCallErrorconsumes the operation error and erases its decoded payload type, so callers that need that payload should match it before conversion. Generated clients do not depend onthiserroror SNAFU; those integrations are documentation and compile-test coverage only. No dead-code lint allowance is emitted.Validation
just fmt-checkjust clippyjust test-all— 1,302 tests passedjust golden-checkRUSTFLAGS=-Dwarnings just golden-rust::build-reqwest— 63/63 clients compiledRUSTFLAGS=-Dwarnings just golden-rust::build-ureq— 63/63 clients compiledRUSTFLAGS=-Dwarnings just golden-rust::build-aioduct— 63/63 clients compiledjust book