blueprint_manager/
error.rs

1use std::fmt::{Display, Formatter};
2
3#[derive(Debug, Clone)]
4pub struct Error {
5    pub message: String,
6}
7
8impl Error {
9    pub fn msg<T: Into<String>>(msg: T) -> Self {
10        Self {
11            message: msg.into(),
12        }
13    }
14}
15
16impl Display for Error {
17    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18        std::fmt::Debug::fmt(self, f)
19    }
20}
21
22impl std::error::Error for Error {}
23
24impl From<std::io::Error> for Error {
25    fn from(error: std::io::Error) -> Self {
26        Error {
27            message: error.to_string(),
28        }
29    }
30}