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
use std::fmt;

/// Custom error type for representing different types of errors.
#[derive(Debug)]
pub enum Errors {
    /// Represents an error that occurred during a request.
    RequestError(String)
}

impl fmt::Display for Errors {
    /// Formats the error for display to end users.
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Errors::RequestError(err) => write!(f, "[Request Error]:🙀 {}", err)
        }
    }
}

impl std::error::Error for Errors {
    /// Provides information about the source of the error.
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
        match self {
            _ => None,
        }
    }
}