use std::fmt::Debug;
use std::io;
use thiserror::Error as ThisError;
use unic_langid::LanguageIdentifierError;
#[derive(ThisError, Debug)]
pub enum LocalizationLoadError {
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("Language identifier error: {0}")]
LangId(#[from] LanguageIdentifierError),
#[error("Error loading fluent resources")]
Fluent,
}
pub fn fluent_load_err<T: Debug>(item: T) -> LocalizationLoadError {
tide::log::error!("Fluent error: {:#?}", item);
LocalizationLoadError::Fluent
}
#[derive(ThisError, Debug)]
#[allow(clippy::enum_variant_names)]
pub enum LocalizationTranslateError {
#[error("No messages are available for this locale")]
NoLocale,
#[error("Message key not found for this locale")]
NoMessage,
#[error("Message key was found, but has no value")]
NoMessageValue,
#[error("Message key was found, but does not have this attribute")]
NoMessageAttribute,
}