Skip to content

feat: add typed Problem details and consistent API errors - #510

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

Failed requests now expose typed Problem details through error.problem. HTTP errors use consistent status-based exceptions, and connection failures and timeouts retain their original cause. Caller cancellation keeps its existing behavior.

Malformed error JSON remains an API error with its HTTP status and text. Reading error details also leaves error.response available for inspection. If reading the body fails, the HTTP status and response headers remain available, with the reading failure in cause.

import { APIError } from '@sumup/sdk';

try {
  await client.checkouts.get('your-checkout-id');
} catch (error) {
  if (error instanceof APIError) {
    console.log(error.status, error.problem?.type, error.problem?.detail);
  } else {
    throw error;
  }
}

Existing APIError catches and error.error access continue to work. Connection failures now raise APIConnectionError, with the original failure in cause.

CI lint uses the same locked formatter as the package build, avoiding conflicting formatting rules.

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
Run lint with the same project formatter used by the build so dependency and CI formatting rules stay aligned.
Keep the HTTP status and response when reading an error body fails, and retain the reading error as the cause. Preserve explicit caller cancellation.
Keep the basic error example with the usage guide so integrators can find it before the events and example sections.
@matoous
matoous marked this pull request as ready for review October 26, 2026 18:34
@matoous
matoous merged commit 0d80d3d into main Oct 26, 2026
10 checks passed
@matoous
matoous deleted the md/problem-errors branch October 26, 2026 18:34
@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