Understand how to handle errors and exceptions in Scalekit SDKs. Proper error handling ensures your application gracefully handles authentication failures, network issues, and invalid requests.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/scalekit-inc/developer-docs/llms.txt
Use this file to discover all available pages before exploring further.
Common Error Types
Scalekit SDKs return errors in these categories:| Error Type | Description | Recovery Strategy |
|---|---|---|
| Authentication Errors | Invalid credentials, expired codes | Redirect to login, refresh tokens |
| Validation Errors | Invalid parameters, missing fields | Fix request parameters |
| Network Errors | Timeout, connection failures | Retry with exponential backoff |
| Configuration Errors | Invalid SDK setup | Check environment variables |
| Authorization Errors | Insufficient permissions | Request proper scopes |
Error Response Format
Errors include these properties:| Field | Description |
|---|---|
error | Error code identifier |
error_description | Human-readable error message |
status | HTTP status code |
Authentication Errors
Invalid Grant
Authorization code expired or already used:Invalid Client
Invalid client credentials:Token Expired
Access token has expired:Validation Errors
Missing Required Parameters
Invalid State Parameter
CSRF protection validation:Network Errors
Connection Timeout
Handle network timeouts with retry logic:Error Logging
Log errors for debugging and monitoring:User-Friendly Error Messages
Display helpful error messages to users:Error mapping
Best Practices
- Always validate input - Check for required parameters before making SDK calls
- Implement retry logic - Handle transient network errors with exponential backoff
- Log errors properly - Include context for debugging without exposing sensitive data
- Provide user feedback - Show clear, actionable error messages to users
- Monitor error rates - Track error patterns to identify systemic issues
- Handle CSRF attacks - Always validate state parameter in OAuth callbacks
- Secure error responses - Never expose internal errors or stack traces to users
- Test error scenarios - Write tests for common error conditions