Typed exceptions for 402 and the remaining documented status codes (0.1.6) - #1
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirrors the change already released in the Python, Node.js and Ruby SDKs.
PaymentRequiredException(402) withQuotaExceededException,CreditLimitExceededExceptionandPaymentFailedExceptionpicked from the response bodyNoSubscriptionExceptionfor the 401 that means the account has no active planNotFoundException(404),BrowserTimeoutException(408),UnsupportedContentException(415),ValidationException(422)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.