grim_rs/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("Invalid geometry format: {0}")]
6    InvalidGeometry(String),
7
8    #[error("No outputs available")]
9    NoOutputs,
10
11    #[error("Output not found: {0}")]
12    OutputNotFound(String),
13
14    #[error("Invalid capture region: {0}")]
15    InvalidRegion(String),
16
17    #[error("Screenshot capture failed")]
18    CaptureFailed,
19
20    #[error("Buffer creation failed: {0}")]
21    BufferCreation(String),
22
23    #[error("Image processing error: {0}")]
24    ImageProcessing(#[from] image::ImageError),
25
26    #[error("IO error: {0}")]
27    Io(#[from] std::io::Error),
28
29    #[error("IO error during {operation}: {source}")]
30    IoWithContext {
31        operation: String,
32        source: std::io::Error,
33    },
34
35    #[error("Compositor doesn't support required protocol: {0}")]
36    UnsupportedProtocol(String),
37
38    #[error("Wayland connection error: {0}")]
39    WaylandConnection(String),
40
41    #[error("Frame capture failed: {0}")]
42    FrameCapture(String),
43
44    #[error("Output transform not supported: {0}")]
45    TransformNotSupported(String),
46
47    #[error("Failed to apply Y-invert transformation: {0}")]
48    InvertFailed(String),
49
50    #[error("Image scaling failed: {0}")]
51    ScalingFailed(String),
52}
53
54pub type Result<T> = std::result::Result<T, Error>;