lib-humus 0.6.0

Helps creating configurable frontends for humans and computers using axum, Tera and toml.
Documentation
// SPDX-FileCopyrightText: 2026 Slatian <baschdel@disroot.org>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

use lib_humus_configuration::HumusConfigError;

use std::path::PathBuf;

use crate::templating::{HumusFormatIdentifier, manifest::TemplatesManifestProblem};

/// Returned when a [TemplatingEngine][crate::templating::TemplatingEngine] fails to initalize.
#[derive(Debug, thiserror::Error)]
pub enum TemplatingEngineLoaderError {
	/// An error occourred while loading the template configuration file.
	#[error("Error with template extra configuration:\n{0}")]
	ConfigurationError(#[source] HumusConfigError),
	/// An error occurred while loading the template manifest file.
	#[error("Error with templates manifest file:\n{0}")]
	TemplatesManifestError(#[source] HumusConfigError),
	/// One or more problems were found in the templates manifest file.
	#[error("Problems found in templates manifest:\n{0:?}")]
	TemplatesManifestProblems(Vec<TemplatesManifestProblem>),
	/// No template directory at.
	#[error("No template directory found at {path:?}.")]
	TemplateDirectoryNotFound {
		/// Where the template directory was expected
		path: PathBuf,
	},
	/// There was an error reading the template directory
	#[error("Error reading template directory at {path:?}")]
	TemplateDirectoryIoError {
		/// Path to the template directory
		path: PathBuf,
		/// The I/O error that occurred
		#[source]
		error: std::io::Error,
	},
	/// An error occourred while parsing the templates.
	#[error("Error parsing templates for format {format:?} at {path:?}:\n{tera_error}")]
	TemplateParseError {
		/// Path to the template directory
		path: PathBuf,
		/// For which format the templates were loaded
		format: HumusFormatIdentifier,
		/// what went wrong
		#[source]
		tera_error: tera::Error,
	},
}