Error Handling
The Skribble SDK provides structured error handling with specific error types for different scenarios. This guide explains the error types and how to handle them effectively.Error Types
Base Error
SkribbleError is the base error class that all other SDK errors inherit from. It provides:
message: A descriptive error message
Authentication Error
SkribbleAuthError is thrown specifically for authentication failures:
API Error
SkribbleAPIError is thrown when the Skribble API returns an error response:
Validation Error
SkribbleValidationError is thrown for input validation failures:
Operation Error
SkribbleOperationError (Python only) provides detailed context about operation failures:
Error Handling Best Practices
Proper Error Type Handling
Proper Error Type Handling
TypeScript Error Handling
TypeScript Error Handling
Error Recovery Strategies
Error Recovery Strategies
- Authentication Errors: Re-authenticate or refresh credentials
- Validation Errors: Fix the invalid data based on the error details
- API Errors: Handle based on status code (retry for 5xx, fix request for 4xx)
- Operation Errors: Log details and handle based on the specific operation