Base Error: SnackBaseError
All SDK errors extend from the baseSnackBaseError class.
Properties
Properties Reference
Error Classes
AuthenticationError
Status Code: 401 Code:AUTHENTICATION_ERROR
Retryable: No
Thrown when authentication fails or tokens are invalid/expired.
- Invalid credentials
- Expired access token
- Missing authorization header
- Invalid API key
AuthorizationError
Status Code: 403 Code:AUTHORIZATION_ERROR
Retryable: No
Thrown when the authenticated user lacks permission for an action.
- Insufficient permissions
- Role-based access control violation
- Collection rule violation
NotFoundError
Status Code: 404 Code:NOT_FOUND_ERROR
Retryable: No
Thrown when a requested resource is not found.
- Invalid record ID
- Non-existent collection
- Non-existent user/account
ConflictError
Status Code: 409 Code:CONFLICT_ERROR
Retryable: No
Thrown when a resource conflict occurs.
- Duplicate unique field value
- Concurrent modification conflict
- Resource already exists
ValidationError
Status Code: 422 Code:VALIDATION_ERROR
Retryable: No
Thrown when request validation fails.
- Missing required fields
- Invalid field values
- Type mismatch
- Constraint violation
RateLimitError
Status Code: 429 Code:RATE_LIMIT_ERROR
Retryable: Yes
Thrown when rate limit is exceeded.
retryAfter: Seconds to wait before retrying
NetworkError
Status Code: N/A Code:NETWORK_ERROR
Retryable: Yes
Thrown when network request fails.
- No internet connection
- DNS resolution failure
- Connection timeout
- CORS error
TimeoutError
Status Code: N/A Code:TIMEOUT_ERROR
Retryable: Yes
Thrown when a request times out.
- Server not responding
- Slow network
- Large request payload
ServerError
Status Code: 500+ Code:SERVER_ERROR
Retryable: Yes
Thrown when a server error occurs.
- Server-side exception
- Database error
- Configuration error
Error Codes Reference
Type Guards
Create type guards for specific errors:Error Logging
Log errors with full context:Next Steps
- Error Overview - Error handling guide
- Configuration - Error callback configuration
- Authentication - Authentication errors