Error Classes
VaultError
Base error class for all VaultSaaS SDK errors. Contains structured error information including code, category, suggestion, and context.Standardized error code identifier.
Error category for grouping similar error types.
Human-readable suggestion for resolving the error.
URL to error documentation with detailed troubleshooting steps.
Whether this error is safe to retry automatically.
Additional context about the error.
VaultConfigError
Thrown when there is an issue with VaultClient configuration or provider setup. Default code:INVALID_CONFIGURATION
Example
VaultRoutingError
Thrown when the routing engine cannot find a suitable provider for a request. Default code:NO_ROUTING_MATCH
Example
VaultProviderError
Thrown when a payment provider returns an error or fails to process a request. Default code:PROVIDER_ERROR
Example
VaultNetworkError
Thrown when a network-level error occurs communicating with a provider or platform. Default code:NETWORK_ERROR
Default retriable: true
Example
WebhookVerificationError
Thrown when webhook signature verification fails. Default code:WEBHOOK_SIGNATURE_INVALID
Example
VaultIdempotencyConflictError
Thrown when an idempotency key is reused with different request parameters. Default code:IDEMPOTENCY_CONFLICT
Example
Error Categories
Errors are grouped into categories for easier handling:Payment was declined by the card issuer or network.
Customer authentication is required (e.g. 3D Secure).
The request contains invalid or missing parameters.
The provider encountered an error processing the request.
The payment was flagged as potentially fraudulent.
The request was rate limited by the provider.
A network-level error occurred.
There is an issue with SDK or provider configuration.
The routing engine could not select a provider.
The error could not be categorized.
Error Codes
Standardized error codes with associated metadata:Configuration Errors
INVALID_CONFIGURATION
- Category:
configuration_error - Retriable:
false - Suggestion: Check VaultClient configuration values and required provider settings.
PROVIDER_NOT_CONFIGURED
- Category:
configuration_error - Retriable:
false - Suggestion: Add the provider adapter and credentials to VaultClient.providers.
ADAPTER_NOT_FOUND
- Category:
configuration_error - Retriable:
false - Suggestion: Install the provider adapter package and wire it in config.
PROVIDER_AUTH_FAILED
- Category:
configuration_error - Retriable:
false - Suggestion: Verify provider credentials and ensure they match the current environment.
Routing Errors
NO_ROUTING_MATCH
- Category:
routing_error - Retriable:
false - Suggestion: Add a matching routing rule or configure a default fallback provider.
ROUTING_PROVIDER_EXCLUDED
- Category:
routing_error - Retriable:
false - Suggestion: Remove the forced provider from exclusions or choose a different provider override.
- Category:
routing_error - Retriable:
false - Suggestion: Enable the provider in config or update routing rules to a valid provider.
Request Errors
INVALID_REQUEST
- Category:
invalid_request - Retriable:
false - Suggestion: Fix invalid or missing request fields before retrying the operation.
IDEMPOTENCY_CONFLICT
- Category:
invalid_request - Retriable:
false - Suggestion: Reuse the same payload for an idempotency key or generate a new key.
WEBHOOK_SIGNATURE_INVALID
- Category:
invalid_request - Retriable:
false - Suggestion: Verify webhook secret, signature algorithm, and that the raw body is unmodified.
Payment Errors
CARD_DECLINED
- Category:
card_declined - Retriable:
false - Suggestion: Ask the customer for another payment method or a retry with updated details.
AUTHENTICATION_REQUIRED
- Category:
authentication_required - Retriable:
false - Suggestion: Trigger customer authentication (for example, a 3DS challenge).
FRAUD_SUSPECTED
- Category:
fraud_suspected - Retriable:
false - Suggestion: Block automatic retries and route the payment through manual fraud review.
Network Errors
RATE_LIMITED
- Category:
rate_limited - Retriable:
true - Suggestion: Apply exponential backoff before retrying provider requests.
NETWORK_ERROR
- Category:
network_error - Retriable:
true - Suggestion: Retry with backoff and confirm outbound connectivity/timeouts to the provider.
PROVIDER_TIMEOUT
- Category:
network_error - Retriable:
true - Suggestion: Retry with backoff and increase timeout if the provider latency is expected.
PLATFORM_UNREACHABLE
- Category:
network_error - Retriable:
true - Suggestion: Use local routing fallback and verify platform API key and network reachability.
Provider Errors
PROVIDER_ERROR
- Category:
provider_error - Retriable:
true - Suggestion: Retry if transient, or fail over to another provider when configured.
PROVIDER_UNKNOWN
- Category:
unknown - Retriable:
false - Suggestion: Capture provider response metadata and map this error case for deterministic handling.