Menu
Public repository / master
AkurAI-Framework / crates/i18n/src/error.rs
Latest change 9876ca1b84b75a78bec25332729ec70f36d4df3d - feat(i18n): add akurai-i18n crate and {{ t }} template helper by Ólafur Búi Ólafsson
//! Error type for `akurai-i18n`.
use std::fmt;
/// An error that occurred while loading or using locale catalogs.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Error {
pub message: String,
}
impl Error {
pub(crate) fn new(message: impl Into<String>) -> Error {
Error {
message: message.into(),
}
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "i18n error: {}", self.message)
}
}
impl std::error::Error for Error {}