emailvalidation_rs/error.rs
1#[derive(Error, Debug)]
2
3/// Contains all possible errors of the crate
4pub enum EmailvalidationError {
5 /// Something went wrong during fetching of
6 /// the emailvalidation api
7 #[error("request to api failed")]
8 RequestError {
9 /// Error source
10 #[source]
11 source: reqwest::Error,
12 },
13 /// Something went wrong during the parsing
14 /// of the emailvalidation api response.
15 #[error("Failed to parse json response: '{body}'")]
16 ResponseParsingError {
17 /// Response body that could not be parsed
18 body: String,
19 },
20 /// Something went wrong during header construction
21 #[error("Failed to construct http header")]
22 HeaderConstruction {
23 /// Error source
24 #[from]
25 source: reqwest::header::InvalidHeaderValue,
26 },
27 /// Something went wrong during http client creation
28 #[error("Failed to create http client")]
29 ClientConstruction {
30 /// Error source
31 #[source]
32 source: reqwest::Error,
33 },
34 /// Failed to parse the request url
35 #[error("Failed to construct the url")]
36 UrlConstruction,
37}