use std::io;
use zbus::Error as ZbusError;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("cannot read sysfs backlight at {path}")]
SysfsRead {
path: String,
#[source]
source: io::Error,
},
#[error("cannot write brightness to {path}")]
SysfsWrite {
path: String,
#[source]
source: io::Error,
},
#[error("cannot set brightness via logind")]
LogindSetFailed(#[source] ZbusError),
#[error("cannot connect to logind session bus")]
LogindConnectionFailed(#[source] ZbusError),
#[error("cannot watch brightness file at {path}")]
WatchFailed {
path: String,
#[source]
source: io::Error,
},
#[error("command channel disconnected")]
CommandChannelDisconnected,
#[error("no backlight devices found")]
NoDevices,
}