1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::error::Error as StdError;
use std::fmt::{self, Display};

#[derive(Debug)]
pub struct Error(String);

impl Error {
    pub fn new(detail: &str) -> Self {
        Self(detail.to_owned())
    }
}

impl StdError for Error {}

impl Display for Error {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(&self.0, fmt)
    }
}