Skip to content

fix: API errors are not wrapped - #230

Open
flcrom wants to merge 4 commits into
Flagsmith:mainfrom
flcrom:fix/error-chain-123
Open

flcrom wants to merge 4 commits into
Flagsmith:mainfrom
flcrom:fix/error-chain-123

Conversation

@flcrom

@flcrom flcrom commented Sep 30, 2026

Copy link
Copy Markdown

Fixes #123.

Add Unwrap to both error types and retain the API error in the public flag methods, so errors.Is and errors.As can reach the underlying request error. Existing messages and response fields stay unchanged.

Tests cover canceled and expired contexts through environment and identity methods, plus API errors with and without a cause. The regressions fail on main and pass with this change.

Passed locally on Go 1.26.6: full race suite, tagged suite, build, vet and golangci-lint 2.13.1.

@flcrom
flcrom requested a review from a team as a code owner September 30, 2026 15:21
@flcrom
flcrom requested review from khvn26 and removed request for a team September 30, 2026 15:21
@flcrom

flcrom commented Oct 10, 2026

Copy link
Copy Markdown
Author

Friendly bump on this. Glad to adjust if anything needs changing.

@khvn26 khvn26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@khvn26 khvn26 changed the title fix: preserve request error chains fix: API errors are not wrapped Oct 12, 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.

Errors are not wrapped with %w

2 participants