Skip to main content

rusty_modbus_gateway/
error.rs

1//! Gateway error types.
2
3use rusty_modbus_tcp::TransportError;
4
5/// Errors that can occur during gateway operations.
6#[derive(Debug, thiserror::Error)]
7pub enum GatewayError {
8    /// Transport-level error.
9    #[error("transport error: {0}")]
10    Transport(#[from] TransportError),
11
12    /// Failed to bind the listen address.
13    #[error("bind failed: {0}")]
14    Bind(std::io::Error),
15
16    /// No route configured for this unit ID.
17    #[error("no route for unit ID {0}")]
18    NoRoute(u8),
19
20    /// Serial device timed out.
21    #[error("serial device timeout for unit ID {0}")]
22    DeviceTimeout(u8),
23}