Skip to content

Typed exceptions for 402 and the remaining documented status codes (0.1.6) - #1

Merged
tomas-vaitiekunas merged 1 commit into
mainfrom
feature/typed-402-errors
Jul 23, 2026
Merged

tomas-vaitiekunas merged 1 commit into
mainfrom
feature/typed-402-errors

Conversation

@tomas-vaitiekunas

Copy link
Copy Markdown
Contributor

Mirrors the change already released in the Python, Node.js and Ruby SDKs.

  • PaymentRequiredException (402) with QuotaExceededException, CreditLimitExceededException and PaymentFailedException picked from the response body
  • NoSubscriptionException for the 401 that means the account has no active plan
  • NotFoundException (404), BrowserTimeoutException (408), UnsupportedContentException (415), ValidationException (422)
  • Accurate per-status messages, full exception table in the README
  • Corrected the stale claim that Oopbuy brand keywords return HTTP 422 (they return 200 with keywordRejected)

Opened as a PR rather than pushed straight to main because PHP is not installed on this machine - CI is the first real run of the new tests.

…des; bump 0.1.6

402 previously surfaced as a bare ApiException with no explanation, even
though it is the status a paying customer is most likely to hit. It now
throws PaymentRequiredException, with a subclass per billing block picked
from the response body (quota, credit limit, failed payment).

Also adds NoSubscriptionException (401 with 'No valid subscription'), plus
NotFoundException (404), BrowserTimeoutException (408),
UnsupportedContentException (415) and ValidationException (422), and
corrects the per-status messages - 400 also covers a missing key header.

Version jumps to 0.1.6 so all four SDKs share one number. All new classes
extend ApiException, so existing handlers keep working.
@tomas-vaitiekunas
tomas-vaitiekunas merged commit 93deab9 into main Jul 23, 2026
3 checks passed
@tomas-vaitiekunas
tomas-vaitiekunas deleted the feature/typed-402-errors branch July 23, 2026 09:14
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