Skip to content

Add SDK error type for custom error propagation#13

Open
manish-raana wants to merge 1 commit into
openapi:mainfrom
manish-raana:main
Open

Add SDK error type for custom error propagation#13
manish-raana wants to merge 1 commit into
openapi:mainfrom
manish-raana:main

Conversation

@manish-raana

Copy link
Copy Markdown

Fixes #11.

This change adds a public openapi_sdk::Error type and openapi_sdk::Result alias so downstream projects can integrate SDK failures into their own error enums with From<openapi_sdk::Error> and
continue using ? in existing Result pipelines.

Changes

  • Added openapi_sdk::Error with variants for HTTP errors, invalid headers, and invalid HTTP methods.
  • Implemented Display, std::error::Error, and From conversions for wrapped error types.
  • Replaced panic-prone unwrap() calls for header and method parsing with returned SDK errors.
  • Added error_for_status() handling for non-2xx HTTP responses.
  • Added regression tests for custom error propagation.
  • Documented custom error integration in README and crates.io docs.

Verification

  • cargo fmt --all -- --check
  • cargo test
  • cargo test --examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant