Skip to main content

libsvm_rs/
error.rs

1/// Errors returned by libsvm-rs operations.
2#[derive(Debug, thiserror::Error)]
3pub enum SvmError {
4    /// An SVM parameter failed validation.
5    #[error("invalid parameter: {0}")]
6    InvalidParameter(String),
7
8    /// A parse error occurred while reading a problem or model file.
9    #[error("parse error at line {line}: {message}")]
10    ParseError {
11        /// 1-based line number where the error occurred.
12        line: usize,
13        /// Description of the parse failure.
14        message: String,
15    },
16
17    /// A model file could not be loaded due to format issues.
18    #[error("model format error: {0}")]
19    ModelFormatError(String),
20
21    /// An I/O error occurred.
22    #[error("I/O error: {0}")]
23    Io(#[from] std::io::Error),
24}