Skip to main content

eero_api/
error.rs

1//! Error types for the eero API client.
2
3use std::io;
4
5/// Errors that can occur when interacting with the eero API.
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8    #[error("HTTP error: {0}")]
9    Http(#[from] reqwest::Error),
10
11    #[error("JSON error: {0}")]
12    Json(#[from] serde_json::Error),
13
14    #[error("I/O error: {0}")]
15    Io(#[from] io::Error),
16
17    #[error("API error {code}: {message}")]
18    Api { code: u16, message: String },
19
20    #[error("not authenticated - call login() and verify() first")]
21    NotAuthenticated,
22
23    #[error("verification required - call verify() with the code sent to your device")]
24    VerificationRequired,
25
26    #[error("credential store error: {0}")]
27    CredentialStore(String),
28}
29
30pub type Result<T> = std::result::Result<T, Error>;