1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error("USB error: {0}")]
12 Usb(#[from] nusb::Error),
13
14 #[error("USB transfer error: {0}")]
15 UsbTransfer(#[from] nusb::transfer::TransferError),
16
17 #[error("IO error: {0}")]
18 Io(#[from] std::io::Error),
19
20 #[error("Device not found")]
21 DeviceNotFound,
22
23 #[error("Device communication failed: {0}")]
24 Communication(String),
25
26 #[error("Invalid response from device")]
27 InvalidResponse,
28
29 #[error("Device status unknown")]
30 StatusUnknown,
31
32 #[error("Failed to claim USB interface")]
33 ClaimInterface,
34
35 #[error("Command failed: {0}")]
36 CommandFailed(String),
37
38 #[error("Invalid chip: {0}")]
39 InvalidChip(String),
40
41 #[error("Invalid firmware file: {0}")]
42 InvalidFirmware(String),
43
44 #[error("Invalid configuration: {0}")]
45 InvalidConfig(String),
46
47 #[error("File not found: {0}")]
48 FileNotFound(String),
49
50 #[error("Parse error: {0}")]
51 Parse(String),
52
53 #[error("Network error: {0}")]
54 Network(String),
55
56 #[error("Decompression error: {0}")]
57 Decompression(String),
58
59 #[error("Invalid argument: {0}")]
60 InvalidArgument(String),
61
62 #[error("Operation failed: {0}")]
63 OperationFailed(String),
64
65 #[error("Verification failed")]
66 VerificationFailed,
67
68 #[error("Unsupported hardware version: {0}")]
69 UnsupportedHardware(u8),
70}