pub enum TelemetryError {
Database(Error),
Http(Error),
Json(Error),
InvalidConfig(String),
Auth(String),
RateLimitExceeded {
retry_after: u64,
},
ServerError {
status: u16,
message: String,
},
MaxRetriesExceeded,
InvalidSchema(String),
Io(Error),
MachineId(String),
Other(String),
}Expand description
Errors that can occur during telemetry operations
Variants§
Database(Error)
SQLite database error
Common causes:
- Database file is locked (another process using it)
- Insufficient permissions to write to database file
- Disk full or quota exceeded
- Corrupted database file
Suggestions:
- Check file permissions on the database directory
- Ensure no other process is using the database
- Try deleting the database file to recreate it (data will be lost)
Http(Error)
HTTP request error
Common causes:
- Network connectivity issues
- Invalid endpoint URL
- Server is down or unreachable
- DNS resolution failure
- SSL/TLS certificate issues
Suggestions:
- Check your internet connection
- Verify the endpoint URL is correct
- Check if the server is accessible via curl/ping
Json(Error)
JSON serialization/deserialization error
Common causes:
- Invalid JSON structure
- Schema version mismatch
- Missing required fields
- Type conversion errors
Suggestions:
- Check that SDK and server versions are compatible
- Verify custom event data is valid JSON
InvalidConfig(String)
Invalid configuration
Suggestions:
- Review the configuration documentation
- Ensure all required fields are provided
- Check that UUIDs are in valid format
Auth(String)
Authentication error
Common causes:
- Invalid or expired token
- Incorrect HMAC secret
- Token doesn’t have required permissions
Suggestions:
- Verify your token and secret are correct
- Generate a new token if the current one is expired
- Check that the token has sync permissions
RateLimitExceeded
Rate limit exceeded
You’ve exceeded the rate limit for your tier.
Suggestions:
- Wait the specified duration before retrying
- Reduce event frequency
- Batch events together
- Consider upgrading to a higher tier
ServerError
Server error with status code
The server encountered an error processing your request.
Suggestions:
- If 5xx error, retry the request after a delay
- If 4xx error, check your request parameters
- Check server status page if available
MaxRetriesExceeded
Maximum retries exceeded
The operation failed after multiple retry attempts.
Common causes:
- Persistent network issues
- Server is down
- Invalid credentials
Suggestions:
- Check server health and network connectivity
- Verify authentication credentials
- Enable offline mode to queue events locally
InvalidSchema(String)
Invalid event schema
The event structure doesn’t match the expected schema.
Suggestions:
- Ensure SDK version is compatible with server
- Check that required event fields are present
- Review event schema documentation
Io(Error)
IO error
Common causes:
- File or directory doesn’t exist
- Insufficient permissions
- Disk full
Suggestions:
- Check file/directory exists and is accessible
- Verify write permissions
- Ensure sufficient disk space
MachineId(String)
Machine ID error
Failed to generate or retrieve a unique machine identifier.
Common causes:
- System doesn’t have machine UUID available
- Insufficient permissions to access machine ID
Suggestions:
- This is usually safe to ignore (fallback ID will be used)
- On Docker/CI, this is expected behavior
Other(String)
Generic error
Implementations§
Source§impl TelemetryError
impl TelemetryError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if the error is retryable
Sourcepub fn invalid_config(field: &str, reason: &str) -> Self
pub fn invalid_config(field: &str, reason: &str) -> Self
Create a helpful InvalidConfig error with context
Sourcepub fn invalid_uuid(field: &str, value: &str) -> Self
pub fn invalid_uuid(field: &str, value: &str) -> Self
Create a helpful InvalidConfig error for UUID validation
Sourcepub fn missing_field(field: &str) -> Self
pub fn missing_field(field: &str) -> Self
Create a helpful error for missing required fields