Skip to main content

piper_plus_g2p/
error.rs

1//! G2P-specific error types.
2//!
3//! [`G2pError`] is independent of `piper-core`'s `PiperError` so that
4//! downstream crates can use `piper-g2p` without pulling in the full
5//! inference stack.
6
7use thiserror::Error;
8
9/// G2P error type, independent of piper-core's `PiperError`.
10#[derive(Error, Debug)]
11pub enum G2pError {
12    #[error("unsupported language: {code}")]
13    UnsupportedLanguage { code: String },
14
15    #[error("unknown phoneme: {phoneme}")]
16    UnknownPhoneme { phoneme: String },
17
18    #[error("phonemization error: {0}")]
19    Phonemize(String),
20
21    #[error("dictionary load error: {path}")]
22    DictionaryLoad { path: String },
23
24    #[error("phoneme ID not found: {phoneme}")]
25    PhonemeIdNotFound { phoneme: String },
26
27    #[error("label parse error: {0}")]
28    LabelParse(String),
29
30    #[error("jpreprocess initialization error: {0}")]
31    JPreprocessInit(String),
32}