> ## Documentation Index
> Fetch the complete documentation index at: https://docs.switch.vaultera.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Error

Handle errors appropriately!

## Error Codes

The following table lists client error codes that the Vaultera Switch SDK returns to your website for graceful handling.

| Error Type               | Error Message                                  |
| ------------------------ | ---------------------------------------------- |
| `invalid_request_error`  | Invalid API key                                |
| `invalid_request_error`  | Invalid value for `<parameter_name>`           |
| `invalid_request_error`  | Missing required parameter: `<parameter_name>` |
| `invalid_request_error`  | Invalid client secret                          |
| `invalid_request_error`  | Invalid promise                                |
| `processing_error`       | Payment failed with the payment processor      |
| `internal_server_error`  | Server is unavailable                          |
| `object_not_found`       | Payment does not exist                         |
| `confirm_payment_failed` | An unknown error occurred                      |

## Error Handling Best Practices

When implementing error handling in your application:

1. **Check for specific error types** to provide appropriate user feedback
2. **Log errors appropriately** for debugging and monitoring purposes
3. **Provide clear user messages** that help users understand what went wrong
4. **Implement retry logic** where appropriate for transient errors
5. **Have fallback mechanisms** for critical payment flows

## Common Error Scenarios

* **Invalid API Key**: Ensure you're using the correct publishable key for your environment
* **Missing Parameters**: Verify all required parameters are included in your requests
* **Invalid Client Secret**: Check that the client secret is valid and hasn't expired
* **Payment Processor Errors**: These may be temporary - consider implementing retry logic
* **Server Unavailable**: Implement appropriate fallback messaging for users
