use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum QueryError {
#[error("failed to read sysfs class directory '{path}': {source}")]
ReadClassDirectory {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("failed to read device metadata from '{path}': {source}")]
ReadDeviceDirectory {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("missing required sysfs file '{path}'")]
MissingFile {
path: PathBuf,
},
#[error("failed to read sysfs file '{path}': {source}")]
ReadFile {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("failed to parse unsigned integer from '{path}': '{content}'")]
ParseFile {
path: PathBuf,
content: String,
},
}
#[derive(Debug, Error)]
pub enum ApplyError {
#[error(transparent)]
Query {
#[from]
source: QueryError,
},
#[error("failed to write brightness to '{path}': {source}")]
WriteFile {
path: PathBuf,
#[source]
source: std::io::Error,
},
}