Skip to content

feat: expose typed Problem details on API errors - #179

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

matoous merged 4 commits into
mainfrom
md/problem-errors

Conversation

@matoous

@matoous matoous commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

API errors currently expose their body only as text. This adds typed Problem details, response headers, and the request URI while keeping the original response text.

try {
    client.checkouts().get("your-checkout-id");
} catch (ApiStatusException error) {
    error.getProblem().ifPresent(problem ->
        System.out.println(problem.type() + ": " + problem.detail()));
}

HTTP failures raise ApiStatusException; connection failures and timeouts raise ApiConnectionException and ApiTimeoutException. All remain catchable as ApiException. Response decoding failures remain distinct from connection failures, and Problem details or titles appear in exception messages. Null-valued Problem extensions are preserved. Malformed error bodies remain HTTP failures with their original text, and asynchronous calls use the same exception types.

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.
@matoous matoous self-assigned this Oct 26, 2026
Keep the additional properties map immutable while allowing valid JSON null values. Cover typed API errors containing a null extension.
Keep synchronous and asynchronous error classification consistent, and use Problem titles when details are absent. Put error handling beside usage and move contributor instructions out of the README.
Use the supported default property inclusion API while preserving the existing omission of null properties and map entries.
@matoous
matoous marked this pull request as ready for review October 26, 2026 19:05
@matoous
matoous merged commit 3046211 into main Oct 26, 2026
12 checks passed
@matoous
matoous deleted the md/problem-errors branch October 26, 2026 19:05
@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