use lib_humus_configuration::HumusConfigError;
use std::path::PathBuf;
use crate::templating::{HumusFormatIdentifier, manifest::TemplatesManifestProblem};
#[derive(Debug, thiserror::Error)]
pub enum TemplatingEngineLoaderError {
#[error("Error with template extra configuration:\n{0}")]
ConfigurationError(#[source] HumusConfigError),
#[error("Error with templates manifest file:\n{0}")]
TemplatesManifestError(#[source] HumusConfigError),
#[error("Problems found in templates manifest:\n{0:?}")]
TemplatesManifestProblems(Vec<TemplatesManifestProblem>),
#[error("No template directory found at {path:?}.")]
TemplateDirectoryNotFound {
path: PathBuf,
},
#[error("Error reading template directory at {path:?}")]
TemplateDirectoryIoError {
path: PathBuf,
#[source]
error: std::io::Error,
},
#[error("Error parsing templates for format {format:?} at {path:?}:\n{tera_error}")]
TemplateParseError {
path: PathBuf,
format: HumusFormatIdentifier,
#[source]
tera_error: tera::Error,
},
}