unifier/error.rs
1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("IO error: {0}")]
8 Io(#[from] std::io::Error),
9
10 #[error("JSON error: {0}")]
11 Json(#[from] serde_json::Error),
12
13 #[error("{0}")]
14 Msg(String),
15}
16
17impl Error {
18 pub fn msg(s: impl Into<String>) -> Self {
19 Self::Msg(s.into())
20 }
21}