Skip to content

feat!: preserve HTTP context alongside typed API errors - #352

Merged
matoous merged 2 commits into
mainfrom
md/problem-errors
Oct 26, 2026
Merged

matoous merged 2 commits into
mainfrom
md/problem-errors

Conversation

@matoous

@matoous matoous commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Failed API calls now retain their HTTP status, headers, and original response bytes in APIError. Documented bodies remain accessible through errors.As, including Problem responses.

var problem *sumup.Problem
if errors.As(err, &problem) {
    fmt.Println(problem.Type)
}
var apiError *sumup.APIError
if errors.As(err, &apiError) {
    fmt.Println(apiError.StatusCode, string(apiError.Body))
}

Malformed and unexpected error bodies retain their response context. Transport errors keep their existing wrapping and cancellation behavior.

Compatibility: documented errors are now wrapped in *APIError. Use errors.As instead of a direct type assertion to inspect a typed body.

The README shows the common error handling path beside SDK usage, with access to the original response for other error details.

Related to sumup/sumup-py#434 and the Python SDK changes in sumup/sumup-py#436.

Expose typed Problem details and preserve error response context. Add focused
regression coverage and concise integration examples.

BREAKING CHANGE: API errors now wrap documented bodies. Use errors.As to inspect
typed errors instead of direct assertions.
@matoous matoous self-assigned this Oct 26, 2026
Place error handling beside the usage guide and show the API request that produces the inspected error.
@matoous
matoous marked this pull request as ready for review October 26, 2026 18:39
@matoous
matoous merged commit 2670a14 into main Oct 26, 2026
15 checks passed
@matoous
matoous deleted the md/problem-errors branch October 26, 2026 18:40
@sumup-release-bot sumup-release-bot Bot mentioned this pull request Oct 26, 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