Download src/error.rs from ThreadAbort/IndexTTS-Rust: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/ThreadAbort/IndexTTS-Rust/resolve/main/src/error.rs
- Command line
-
hf download hf://ThreadAbort/IndexTTS-Rust/src/error.rs
-
curl -L -o error.rs https://huggingface.co/ThreadAbort/IndexTTS-Rust/resolve/main/src/error.rs
1.96 kB
| //! Error types for IndexTTS | |
| use thiserror::Error; | |
| /// Main error type for IndexTTS | |
| pub enum Error { | |
| Audio(String), | |
| Text(String), | |
| Model(String), | |
| Config(String), | |
| Io( std::io::Error), | |
| FileNotFound(String), | |
| InvalidFormat(String), | |
| Onnx(String), | |
| Tokenization(String), | |
| ModelLoading(String), | |
| Inference(String), | |
| Vocoder(String), | |
| Unsupported(String), | |
| Download(String), | |
| ShapeMismatch { expected: String, actual: String }, | |
| } | |
| /// Result type for IndexTTS operations | |
| pub type Result<T> = std::result::Result<T, Error>; | |
| impl From<serde_yaml::Error> for Error { | |
| fn from(err: serde_yaml::Error) -> Self { | |
| Error::Config(err.to_string()) | |
| } | |
| } | |
| impl From<serde_json::Error> for Error { | |
| fn from(err: serde_json::Error) -> Self { | |
| Error::Config(err.to_string()) | |
| } | |
| } | |
| impl From<hound::Error> for Error { | |
| fn from(err: hound::Error) -> Self { | |
| Error::Audio(err.to_string()) | |
| } | |
| } | |
| impl From<ndarray::ShapeError> for Error { | |
| fn from(err: ndarray::ShapeError) -> Self { | |
| Error::ShapeMismatch { | |
| expected: "valid shape".into(), | |
| actual: err.to_string(), | |
| } | |
| } | |
| } | |
| impl From<regex::Error> for Error { | |
| fn from(err: regex::Error) -> Self { | |
| Error::Text(err.to_string()) | |
| } | |
| } | |