Skip to content

fix: out of credits (403) raises InsufficientCreditsError (v0.1.4) - #14

Merged
OussemaFr merged 1 commit into
mainfrom
fix/insufficient-credits-403
Nov 19, 2026
Merged

OussemaFr merged 1 commit into
mainfrom
fix/insufficient-credits-403

Conversation

@OussemaFr

Copy link
Copy Markdown
Member

When a customer runs out of credits the API answers 403 {"error": "Insufficient credits", "creditsNeeded": N}. The SDK only mapped 402 to the out-of-credits error, so callers got a generic bad-request error.

  • A 403 whose error / message mentions credits, or that carries creditsNeeded, is now the out-of-credits error; 402 still is.
  • Other 403s (SUBSCRIPTION_PAUSED, SUBSCRIPTION_EXPIRED) are unchanged.
  • Version 0.1.4 + CHANGELOG, two new tests (403 credits, 403 expired plan).

The API answers 403 {"error": "Insufficient credits", "creditsNeeded": n} when the balance is too low; only 402 was mapped, so callers got a generic bad-request error. Other 403s (paused account, expired plan) are unchanged.
@OussemaFr
OussemaFr merged commit fdeffd2 into main Nov 19, 2026
6 checks passed
@OussemaFr
OussemaFr deleted the fix/insufficient-credits-403 branch November 19, 2026 13:21
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