use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum CaptureError {
#[error("target window not found: {0}")]
TargetNotFound(String),
#[error("target window closed")]
WindowClosed,
#[error("capture backend error: {0}")]
Backend(String),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("image decode error: {0}")]
Decode(String),
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum SinkError {
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("serialization error: {0}")]
Serde(#[from] serde_json::Error),
#[error("image encode error: {0}")]
Encode(String),
#[error("channel receiver disconnected")]
Disconnected,
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error(transparent)]
Capture(#[from] CaptureError),
#[error(transparent)]
Sink(#[from] SinkError),
#[error("invalid configuration: {0}")]
Config(String),
#[error("no capture backend available: {0}")]
NoBackend(String),
#[error(transparent)]
Io(#[from] std::io::Error),
}