snm_brightdata_client/
error.rs

1// src/error.rs - Enhanced version with additional error types
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum BrightDataError {
6    #[error("Request failed: {0}")]
7    Request(#[from] reqwest::Error),
8
9    #[error("Network error: {0}")]
10    NetworkError(String),
11
12    #[error("API error: {0}")]
13    ApiError(String),
14
15    #[error("Parse error: {0}")]
16    ParseError(String),
17
18    #[error("Config error: {0}")]
19    ConfigError(String),
20
21    #[error("Invalid input: {0}")]
22    InvalidInput(String),
23
24    #[error("Unexpected error: {0}")]
25    Unexpected(#[from] anyhow::Error),
26
27    #[error("Tool call failed: {0}")]
28    ToolError(String),
29
30    #[error("Serialization error: {0}")]
31    Serialization(#[from] serde_json::Error),
32
33    #[error("IO error: {0}")]
34    Io(#[from] std::io::Error),
35
36    #[error("Tool not found: {0}")]
37    ToolNotFound(String),
38
39    #[error("Rate limit exceeded: {0}")]
40    RateLimitExceeded(String),
41
42    #[error("Authentication failed: {0}")]
43    AuthenticationFailed(String),
44
45    #[error("Zone not found: {0}")]
46    ZoneNotFound(String),
47
48    #[error("Timeout error: {0}")]
49    Timeout(String),
50
51    #[error("Validation error: {0}")]
52    ValidationError(String),
53}