1#[derive(Debug, thiserror_no_std::Error)]
3pub enum Error<Io> {
4 #[error(transparent)]
6 Io(Io),
7 #[error("unexpected end of file")]
9 UnexpectedEof,
10 #[error(transparent)]
12 Crc(#[from] CrcError),
13 #[error("unexpected response from server")]
15 UnexpectedResponse,
16}
17
18#[derive(Debug, Clone, Copy, thiserror_no_std::Error)]
20#[error("CRC validation failed")]
21pub struct CrcError;
22
23#[derive(Debug, thiserror_no_std::Error)]
25pub enum ValidationError {
26 #[error(transparent)]
28 Crc(#[from] CrcError),
29 #[error("unexpected response")]
31 UnexpectedResponse,
32}
33
34impl<E> From<ValidationError> for Error<E> {
35 fn from(e: ValidationError) -> Self {
36 match e {
37 ValidationError::Crc(crc) => Error::Crc(crc),
38 ValidationError::UnexpectedResponse => Error::UnexpectedResponse,
39 }
40 }
41}