gardesk/garlock / 9b88a72

Browse files

Add garlock crate with error types

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9b88a72302f6786062d4e7c81cbdae5300432cf3
Parents
4e5f0ff
Tree
9e4395a

2 changed files

StatusFile+-
A garlock/Cargo.toml 56 0
A garlock/src/error.rs 38 0
garlock/Cargo.tomladded
@@ -0,0 +1,56 @@
1
+[package]
2
+name = "garlock"
3
+version.workspace = true
4
+edition.workspace = true
5
+authors.workspace = true
6
+license.workspace = true
7
+description = "Screen locker for the gar desktop suite"
8
+
9
+[[bin]]
10
+name = "garlock"
11
+path = "src/main.rs"
12
+
13
+[dependencies]
14
+# X11
15
+x11rb.workspace = true
16
+
17
+# Graphics
18
+cairo-rs.workspace = true
19
+pango.workspace = true
20
+pangocairo.workspace = true
21
+image.workspace = true
22
+
23
+# Authentication
24
+pam.workspace = true
25
+
26
+# Async
27
+tokio.workspace = true
28
+
29
+# Configuration
30
+toml.workspace = true
31
+serde.workspace = true
32
+serde_json.workspace = true
33
+
34
+# Logging
35
+tracing.workspace = true
36
+tracing-subscriber.workspace = true
37
+
38
+# Error handling
39
+anyhow.workspace = true
40
+thiserror.workspace = true
41
+
42
+# CLI
43
+clap.workspace = true
44
+
45
+# Unix
46
+nix.workspace = true
47
+
48
+# Security
49
+zeroize.workspace = true
50
+
51
+# Keyboard
52
+xkbcommon.workspace = true
53
+
54
+# Utilities
55
+dirs.workspace = true
56
+users.workspace = true
garlock/src/error.rsadded
@@ -0,0 +1,38 @@
1
+//! Error types for garlock
2
+
3
+use thiserror::Error;
4
+
5
+/// Main error type for garlock
6
+#[derive(Error, Debug)]
7
+pub enum GarlockError {
8
+    /// X11 connection or operation failed
9
+    #[error("X11 error: {0}")]
10
+    X11(String),
11
+
12
+    /// Failed to grab keyboard or pointer
13
+    #[error("Failed to grab input: {0}")]
14
+    GrabFailed(String),
15
+
16
+    /// Screenshot capture failed
17
+    #[error("Screenshot failed: {0}")]
18
+    ScreenshotFailed(String),
19
+
20
+    /// PAM authentication error
21
+    #[error("Authentication error: {0}")]
22
+    AuthError(String),
23
+
24
+    /// Configuration error
25
+    #[error("Configuration error: {0}")]
26
+    ConfigError(String),
27
+
28
+    /// IPC error
29
+    #[error("IPC error: {0}")]
30
+    IpcError(String),
31
+
32
+    /// Rendering error
33
+    #[error("Rendering error: {0}")]
34
+    RenderError(String),
35
+}
36
+
37
+/// Result type alias for garlock
38
+pub type Result<T> = std::result::Result<T, GarlockError>;