1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[derive(Debug, Clone, PartialEq, Eq)]
/// An error returned from the API.
pub struct Error(String);

impl Error {
    /// Get the error message;
    pub fn message(&self) -> &str {
        self.0.as_str()
    }
}

impl<T> From<T> for Error
where
    T: ToString,
{
    fn from(error: T) -> Self {
        Self(error.to_string())
    }
}