sdm72_lib/
error.rs

1use crate::protocol::{self};
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    #[error(
6        "The address value {0} is outside the permissible range of {min} to {max}",
7        min = protocol::Address::MIN,
8        max = protocol::Address::MAX
9    )]
10    AddressOutOfRange(u8),
11    #[error(
12        "The password value {0} is outside the permissible range of {min} to {max}",
13        min = protocol::Password::MIN,
14        max = protocol::Password::MAX
15    )]
16    PasswordOutOfRange(u16),
17    #[error(
18        "The auto scroll time value {0} is outside the permissible range of {min} to {max}",
19        min = protocol::AutoScrollTime::MIN,
20        max = protocol::AutoScrollTime::MAX
21    )]
22    AutoScrollTimeOutOfRange(u8),
23    #[error(
24        "The backlit time value {0} is outside the permissible range of {min} to {max}",
25        min = protocol::BacklightTime::MIN,
26        max = protocol::BacklightTime::MAX
27    )]
28    BacklitTimeOutOfRange(u8),
29    #[error("Baud rate must by any value of 1200, 2400, 4800, 9600, 19200.")]
30    InvalidBaudRate,
31    #[error("Value is outside the permissible range")]
32    OutOfRange,
33    #[error("Unexpected value")]
34    InvalidValue,
35    #[error("Words count error")]
36    WordsCountError,
37}