1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Error types for any-tts.
use thiserror::Error;
/// Primary error type for all TTS operations.
#[derive(Error, Debug)]
pub enum TtsError {
/// The requested model type is not compiled in or not supported.
#[error("Unsupported model: {0}")]
UnsupportedModel(String),
/// Failed to load model weights from disk.
#[error("Failed to load model weights: {0}")]
WeightLoadError(String),
/// Failed to parse model configuration.
#[error("Configuration error: {0}")]
ConfigError(String),
/// Error during tensor computation (candle).
#[error("Compute error: {0}")]
ComputeError(#[from] candle_core::Error),
/// Error during text tokenization.
#[error("Tokenizer error: {0}")]
TokenizerError(String),
/// The requested voice/speaker is not available.
#[error("Unknown voice: {0}")]
UnknownVoice(String),
/// The requested language is not supported.
#[error("Unsupported language: {0}")]
UnsupportedLanguage(String),
/// I/O error (file access, download, etc.).
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
/// JSON parsing error.
#[error("JSON error: {0}")]
JsonError(#[from] serde_json::Error),
/// Model path was not provided and download is not available.
#[error("Model path not specified and download feature is not enabled")]
ModelPathMissing,
/// A required model file was not provided and could not be resolved.
#[error("Required file missing: {0}")]
FileMissing(String),
/// Generic error for model-specific issues.
#[error("Model error: {0}")]
ModelError(String),
/// Error from an external runtime, process, or HTTP service.
#[error("Runtime error: {0}")]
RuntimeError(String),
/// Error during audio encoding (WAV, MP3, etc.).
#[error("Audio encoding error: {0}")]
AudioError(String),
}
/// Convenience type alias for Results with [`TtsError`].
pub type TtsResult<T> = Result<T, TtsError>;