fennec_modbus/error.rs
1use bytes::TryGetError;
2use thiserror::Error;
3
4use crate::protocol::Exception;
5
6/// Modbus protocol error.
7#[derive(Debug, Error)]
8pub enum Error {
9 #[error("exception")]
10 Exception(#[from] Exception),
11
12 #[error("not enough bytes to read")]
13 TryGetError(#[from] TryGetError),
14
15 #[error("unexpected function code ({0})")]
16 UnexpectedFunctionCode(u8),
17
18 #[error("payload size exceeded ({0} bytes)")]
19 PayloadSizeExceeded(usize),
20}