coins_ledger/transports/native/
error.rs1use thiserror::Error;
2
3#[cfg(not(target_os = "linux"))]
5mod nix {
6 #[derive(thiserror::Error, Debug, Copy, Clone)]
7 pub enum Error {
8 #[error("")]
9 Unimplemented,
10 }
11}
12
13#[derive(Error, Debug)]
15pub enum NativeTransportError {
16 #[error("Ledger device not found")]
18 DeviceNotFound,
19 #[error("Error opening device. {0}. Hint: This usually means that the device is already in use by another transport instance.")]
21 CantOpen(hidapi_rusb::HidError),
22 #[error("Sequence mismatch. Got {got} from device. Expected {expected}")]
24 SequenceMismatch {
25 got: u16,
27 expected: u16,
29 },
30 #[error("Ledger device: communication error `{0}`")]
32 Comm(&'static str),
33 #[error(transparent)]
35 Ioctl(#[from] nix::Error),
36 #[error(transparent)]
38 Io(#[from] std::io::Error),
39 #[error(transparent)]
41 Hid(#[from] hidapi_rusb::HidError),
42 #[error(transparent)]
44 UTF8(#[from] std::str::Utf8Error),
45 #[error("Invalid TERMUX_USB_FD variable. Are you using termux-usb?")]
49 InvalidTermuxUsbFd,
50}