1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum PiperError {
5 #[error("config file not found: {path}")]
6 ConfigNotFound { path: String },
7
8 #[error("invalid config: {reason}")]
9 InvalidConfig { reason: String },
10
11 #[error("model load failed: {0}")]
12 ModelLoad(String),
13
14 #[error("unsupported language: {code}")]
15 UnsupportedLanguage { code: String },
16
17 #[error("unknown phoneme: {phoneme}")]
18 UnknownPhoneme { phoneme: String },
19
20 #[error("inference failed: {0}")]
21 Inference(String),
22
23 #[error("audio output error: {0}")]
24 AudioOutput(#[from] std::io::Error),
25
26 #[error("JSON parse error: {0}")]
27 JsonParse(#[from] serde_json::Error),
28
29 #[error("WAV write error: {0}")]
30 WavWrite(String),
31
32 #[error("phonemization error: {0}")]
33 Phonemize(String),
34
35 #[error("dictionary load error: {path}")]
36 DictionaryLoad { path: String },
37
38 #[error("jpreprocess initialization error: {0}")]
39 JPreprocessInit(String),
40
41 #[error("label parse error: {0}")]
42 LabelParse(String),
43
44 #[error("phoneme ID not found: {phoneme}")]
45 PhonemeIdNotFound { phoneme: String },
46
47 #[error("streaming error: {0}")]
49 Streaming(String),
50
51 #[error("playback error: {0}")]
52 Playback(String),
53
54 #[error("timing error: {0}")]
55 Timing(String),
56
57 #[error("download error: {0}")]
58 Download(String),
59
60 #[error("resampling error: {0}")]
61 Resample(String),
62
63 #[error("device error: {0}")]
64 Device(String),
65
66 #[error("batch processing error: {0}")]
67 Batch(String),
68
69 #[error("WASM error: {0}")]
70 Wasm(String),
71}