bimp_net/error.rs
1use thiserror::Error as ThisError;
2
3/// Error type returned by `bimp-net` operations.
4#[derive(Debug, ThisError)]
5pub enum Error {
6 /// The native curl handle or impersonation target could not be initialized.
7 #[error("curl initialization failed: {0}")]
8 Initialization(String),
9 /// The request could not be represented as a curl transfer.
10 #[error("invalid request: {0}")]
11 InvalidRequest(String),
12 /// The transfer failed while communicating with the network.
13 #[error("network error: {0}")]
14 Network(String),
15 /// The response status, headers, or body could not be constructed.
16 #[error("response error: {0}")]
17 Response(String),
18}
19
20/// Result alias using [`Error`] as the default error type.
21pub type Result<T> = std::result::Result<T, Error>;