Skip to main content

gecol_core/
error.rs

1use thiserror::Error;
2
3/// Gecol error wrapper around all the possible errors.
4#[derive(Debug, Error)]
5pub enum Error {
6    #[error(transparent)]
7    IO(#[from] std::io::Error),
8    #[error(transparent)]
9    Img(#[from] image::ImageError),
10    #[error(transparent)]
11    Postcard(#[from] postcard::Error),
12    #[error(transparent)]
13    MiniJinja(#[from] minijinja::Error),
14    #[error("{0}")]
15    Msg(String),
16}
17
18impl From<String> for Error {
19    fn from(value: String) -> Self {
20        Self::Msg(value)
21    }
22}
23
24impl From<&str> for Error {
25    fn from(value: &str) -> Self {
26        Self::Msg(value.to_string())
27    }
28}