1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// Module `error` - Defines error types for API error handling.
///
/// # Enum `ApiError`
/// An enumeration representing possible errors encountered during
/// API interaction. It is designed to encapsulate all error types into a single
/// manageable enum.
///
/// ## Variants
/// - `Error(String)`: A general error with a message.
/// - `RequestError(reqwest::Error)`: An error from the `reqwest` HTTP client.
///
/// # Trait Implementations
/// Implementation of `From<reqwest::Error>` trait for `ApiError` allows automatic conversion
/// which is useful for `?` operator use in error handling.
///
/// # Usage
/// This enum can be used to return and propagate errors in API related operations,
/// simplifying the match operations and conversion from other error types.
///
/// # Examples
/// ```rust
/// fn example() -> Result<(), ApiError> {
/// let result = reqwest::get("https://example.com")
/// .await
/// .map_err(ApiError::from)?;
/// // Handle result
/// Ok(())
/// }
/// ```
///