1use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum Error {
7 #[error("Device not created")]
8 DeviceNotCreated,
9
10 #[error("Device already exists")]
11 DeviceAlreadyExists,
12
13 #[error("Failed to create device: {0}")]
14 CreateFailed(String),
15
16 #[error("Failed to send report: {0}")]
17 SendFailed(String),
18
19 #[error("Platform not supported: {0}")]
20 PlatformNotSupported(String),
21
22 #[error("Invalid key: {0}")]
23 InvalidKey(String),
24
25 #[error("Invalid action: {0}")]
26 InvalidAction(String),
27
28 #[error("IO error: {0}")]
29 Io(#[from] std::io::Error),
30
31 #[error("JSON error: {0}")]
32 Json(#[from] serde_json::Error),
33}
34
35pub type Result<T> = std::result::Result<T, Error>;