Errors
Error classes thrown by @recur/sdk and how to handle them.
Errors
All errors thrown by @recur/sdk extend the base RecurError class. Use instanceof to handle specific cases.
Error classes
| Class | When thrown |
|---|---|
RecurError | Base class for all SDK errors |
WalletRejectedError | User declined the wallet prompt (sign or signMessage) |
InsufficientFundsError | Subscriber's USDC balance can't cover the payment |
DelegationExhaustedError | SPL Token approval used up — call reapprove() |
PlanInactiveError | Plan was disabled or archived by the merchant |
SubscriptionAlreadyExistsError | Subscriber already has an active subscription on this plan |
NetworkError | RPC node or Recur API unreachable |
AuthError | JWT invalid, expired, or auth flow failed |
Handling errors
mapError
The SDK exports a mapError utility that converts raw errors (RPC failures, HTTP errors) into typed RecurError subclasses:
Error properties
All RecurError instances have: