ykoath_protocol/
error.rs

1use std::num::TryFromIntError;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    #[error(transparent)]
6    Pcsc(#[from] pcsc::Error),
7    #[error(transparent)]
8    TryFromInt(#[from] TryFromIntError),
9
10    #[error("no YubiKey found")]
11    NoDevice,
12    #[error("response does not have enough length")]
13    InsufficientData,
14    #[error("unknown response code (0x{0:04x})")]
15    UnknownCode(u16),
16    #[error("unexpected value (0x{0:02x}")]
17    UnexpectedValue(u8),
18    #[error("no space")]
19    NoSpace,
20    #[error("no such object")]
21    NoSuchObject,
22    #[error("auth required")]
23    AuthRequired,
24    #[error("wrong syntax")]
25    WrongSyntax,
26    #[error("generic error")]
27    GenericError,
28}