client_3dsdb/error.rs
1//! Custom errors.
2//!
3//! A small module that contains a custom error struct used to encapsulate errors from lower down in
4//! the function call chain.
5//!
6
7
8use std::fmt::{Display, Formatter};
9
10/// A custom error struct. Contains the string representation for the encapsulated error.
11#[derive(Debug, Clone)]
12pub struct Error {
13    pub message: String
14}
15
16impl Display for Error {
17    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18        write!(f, "{}", self.message)
19    }
20}
21
22impl From<reqwest::Error> for Error {
23    fn from(value: reqwest::Error) -> Self {
24        Error { message: value.to_string() }
25    }
26}