use alloc::string::String;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, thiserror::Error)]
#[non_exhaustive]
pub enum ShabdaError {
#[error("invalid input: {0}")]
InvalidInput(String),
#[error("unknown word: {0}")]
UnknownWord(String),
#[error("unsupported language: {0}")]
UnsupportedLanguage(String),
#[error("rule error: {0}")]
RuleError(String),
#[error("dictionary parse error: {0}")]
DictParseError(String),
}
pub type Result<T> = core::result::Result<T, ShabdaError>;
impl From<shabdakosh::ShabdakoshError> for ShabdaError {
fn from(e: shabdakosh::ShabdakoshError) -> Self {
ShabdaError::DictParseError(alloc::format!("{e}"))
}
}