pub enum SerperError {
Request(Error),
Json(Error),
Api {
message: String,
},
InvalidApiKey,
Config {
message: String,
},
Validation {
message: String,
},
}
Expand description
Main error type for the Serper SDK
This enum covers all possible error conditions that can occur when using the SDK, from network issues to API-specific errors.
Variants§
Request(Error)
HTTP request failed
This error wraps underlying HTTP transport errors
Json(Error)
JSON parsing failed
This error occurs when the API returns invalid JSON or when serialization/deserialization fails
Api
API returned an error response
This error represents HTTP error status codes and API-specific errors
InvalidApiKey
Invalid API key provided
This error occurs when the API key is empty, malformed, or rejected
Config
Configuration error
This error occurs when SDK configuration is invalid
Validation
Validation error
This error occurs when input parameters are invalid
Implementations§
Source§impl SerperError
impl SerperError
Sourcepub fn api_error(message: impl Into<String>) -> Self
pub fn api_error(message: impl Into<String>) -> Self
Creates a new API error with a custom message
Sourcepub fn config_error(message: impl Into<String>) -> Self
pub fn config_error(message: impl Into<String>) -> Self
Creates a new configuration error
Sourcepub fn validation_error(message: impl Into<String>) -> Self
pub fn validation_error(message: impl Into<String>) -> Self
Creates a new validation error
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Checks if the error is related to authentication
Sourcepub fn is_network_error(&self) -> bool
pub fn is_network_error(&self) -> bool
Checks if the error is related to network/transport
Sourcepub fn is_parse_error(&self) -> bool
pub fn is_parse_error(&self) -> bool
Checks if the error is related to data parsing
Sourcepub fn is_api_error(&self) -> bool
pub fn is_api_error(&self) -> bool
Checks if the error is an API error