Skip to main content

csv_nose/
error.rs

1use std::io;
2use thiserror::Error;
3
4/// Error type for CSV sniffing operations.
5#[derive(Error, Debug)]
6pub enum SnifferError {
7    /// IO error during file operations.
8    #[error("IO error: {0}")]
9    Io(#[from] io::Error),
10
11    /// CSV parsing error.
12    #[error("CSV parsing error: {0}")]
13    Csv(#[from] csv::Error),
14
15    /// No valid dialect could be detected.
16    #[error("Could not detect CSV dialect: {0}")]
17    NoDialectDetected(String),
18
19    /// Empty file or no data.
20    #[error("Empty file or no data to analyze")]
21    EmptyData,
22
23    /// Invalid configuration.
24    #[error("Invalid configuration: {0}")]
25    InvalidConfig(String),
26}
27
28/// Result type alias for sniffing operations.
29pub type Result<T> = std::result::Result<T, SnifferError>;