Skip to main content

mabi_bacnet/
error.rs

1//! BACnet error types.
2
3use thiserror::Error;
4use mabi_core::Error as CoreError;
5
6/// BACnet result type.
7pub type BacnetResult<T> = Result<T, BacnetError>;
8
9/// BACnet error types.
10#[derive(Debug, Error)]
11pub enum BacnetError {
12    /// Object not found.
13    #[error("Object not found: {object_type}:{instance}")]
14    ObjectNotFound { object_type: String, instance: u32 },
15
16    /// Property not found.
17    #[error("Property not found: {property}")]
18    PropertyNotFound { property: String },
19
20    /// Invalid object type.
21    #[error("Invalid object type: {0}")]
22    InvalidObjectType(u16),
23
24    /// Server error.
25    #[error("Server error: {0}")]
26    Server(String),
27
28    /// Protocol error.
29    #[error("Protocol error: {0}")]
30    Protocol(String),
31
32    /// I/O error.
33    #[error("I/O error: {0}")]
34    Io(#[from] std::io::Error),
35
36    /// Core error.
37    #[error("Core error: {0}")]
38    Core(#[from] CoreError),
39}