use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Lexer error at line {line}, column {column}: {message}")]
Lexer {
line: usize,
column: usize,
message: String,
},
#[error("Parser error at line {line}, column {column}: {message}")]
Parser {
line: usize,
column: usize,
message: String,
},
#[error("Invalid preference: {0}")]
InvalidPreference(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Profile '{name}' not found in {directory}")]
ProfileNotFound { name: String, directory: PathBuf },
#[error("Invalid profile directory: {0}")]
InvalidProfileDirectory(PathBuf),
#[error("Invalid glob pattern: {0}")]
InvalidGlobPattern(String),
#[error("Failed to parse profiles.ini: {0}")]
ProfilesIniParse(String),
#[error("Firefox installation not found. Searched paths: {searched_paths}")]
FirefoxNotFound { searched_paths: String },
#[error("omni.ja error: {0}")]
OmniJaError(String),
#[error("Preference file not found: {file}")]
PrefFileNotFound { file: String },
#[error("File extraction failed: {0}")]
ExtractionFailed(String),
#[error(
"omni.ja file is too large ({actual} bytes). Maximum safe size is {limit} bytes. \
You can increase this limit with --max-file-size if you're sure the file is valid."
)]
OmniJaTooLarge { actual: usize, limit: usize },
}
pub type Result<T> = std::result::Result<T, Error>;