Skip to main content

oximedia_mir/
error.rs

1//! Error types for MIR analysis.
2
3use thiserror::Error;
4
5/// MIR error type.
6#[derive(Debug, Error)]
7pub enum MirError {
8    /// Invalid audio input.
9    #[error("Invalid audio input: {0}")]
10    InvalidInput(String),
11
12    /// Insufficient data for analysis.
13    #[error("Insufficient data: {0}")]
14    InsufficientData(String),
15
16    /// Analysis failed.
17    #[error("Analysis failed: {0}")]
18    AnalysisFailed(String),
19
20    /// FFT error.
21    #[error("FFT error: {0}")]
22    FftError(String),
23
24    /// Invalid configuration.
25    #[error("Invalid configuration: {0}")]
26    InvalidConfig(String),
27
28    /// Feature extraction failed.
29    #[error("Feature extraction failed: {0}")]
30    FeatureExtractionFailed(String),
31
32    /// Model error.
33    #[error("Model error: {0}")]
34    ModelError(String),
35
36    /// ML pipeline error (only available when the `onnx` feature is enabled).
37    #[cfg(feature = "onnx")]
38    #[error("ML error: {0}")]
39    Ml(#[from] oximedia_ml::MlError),
40}
41
42/// Result type for MIR operations.
43pub type MirResult<T> = Result<T, MirError>;