mta_sdk/error.rs
1use std::fmt;
2
3/// Custom error type for representing different types of errors.
4#[derive(Debug)]
5pub enum Errors {
6 /// Represents an error that occurred during a request.
7 RequestError(String)
8}
9
10impl fmt::Display for Errors {
11 /// Formats the error for display to end users.
12 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13 match self {
14 Errors::RequestError(err) => write!(f, "[Request Error]:🙀 {}", err)
15 }
16 }
17}
18
19impl std::error::Error for Errors {
20 /// Provides information about the source of the error.
21 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
22 match self {
23 _ => None,
24 }
25 }
26}