azizo_core/
error.rs

1//! Error types for the ASUS display controller.
2
3/// Errors that can occur when using the ASUS display controller.
4#[derive(Debug, thiserror::Error)]
5pub enum ControllerError {
6    /// The ASUS PC Assistant package was not found.
7    #[error("Package not found (error code: {0})")]
8    PackageNotFound(u32),
9
10    /// Failed to get the package installation path.
11    #[error("Failed to get package path (error code: {0})")]
12    PackagePathError(u32),
13
14    /// Failed to load the ASUS DLL.
15    #[error("Failed to load DLL: {0}")]
16    DllLoad(#[from] libloading::Error),
17
18    /// RPC client initialization failed.
19    #[error("RPC initialization failed")]
20    RpcInitFailed,
21
22    /// Attempted to create a second controller instance.
23    #[error("Controller already initialized - only one instance allowed")]
24    AlreadyInitialized,
25
26    /// A slider value was outside the valid range.
27    #[error("Invalid slider value {value} for {mode} (expected {min}-{max})")]
28    InvalidSliderValue {
29        /// The mode name.
30        mode: &'static str,
31        /// The invalid value provided.
32        value: u8,
33        /// Minimum allowed value.
34        min: u8,
35        /// Maximum allowed value.
36        max: u8,
37    },
38
39    /// An I/O error occurred (e.g., copying the DLL).
40    #[error("IO error: {0}")]
41    Io(#[from] std::io::Error),
42
43    /// Failed to detect the current display mode.
44    #[error("Failed to get current mode")]
45    ModeNotDetected,
46
47    /// Failed to set the dimming level.
48    #[error("Failed to set dimming (error code: {0})")]
49    DimmingFailed(i64),
50}