mal_api/anime/
error.rs

1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct AnimeApiError {
6    pub message: String,
7}
8
9impl Error for AnimeApiError {}
10
11impl fmt::Display for AnimeApiError {
12    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13        write!(f, "{}", self.message)
14    }
15}
16
17impl AnimeApiError {
18    pub fn new(message: String) -> Self {
19        Self { message }
20    }
21}