Skip to main content

sweet_potator/
error.rs

1use std::{io, path::PathBuf};
2
3use crate::recipe::errors::ParseError;
4
5pub type Result<T> = std::result::Result<T, Error>;
6
7#[derive(thiserror::Error, Debug)]
8pub enum Error {
9    #[error("a recipe title must contain non-whitespace characters")]
10    EmptyRecipeTitle,
11    #[error("invalid image file extension: '{0}'")]
12    InvalidImageFileExt(PathBuf),
13    #[error("invalid language file format: {0}")]
14    InvalidLanguageFileFormat(#[from] toml::de::Error),
15    #[error(transparent)]
16    Io(#[from] io::Error),
17    #[error(transparent)]
18    Parse(#[from] ParseError),
19    #[error("missing image file extension in path: '{0}'")]
20    MissingImageFileExt(PathBuf),
21    #[error("missing template file: '{0}'")]
22    MissingTemplateFile(String),
23    #[error(transparent)]
24    Tera(#[from] tera::Error),
25}