1use zigbee_primitives::{Ieee, NodeId};
4
5#[derive(Debug, Clone, thiserror::Error)]
7pub enum HostError {
8 #[error("NCP: {0}")]
10 Ncp(String),
11 #[error("the coordinator runs another network ({found}); refusing to replace it")]
14 NetworkMismatch {
15 found: String,
17 },
18 #[error("cannot restore: {0}")]
21 RestoreRefused(String),
22 #[error("coordinator IEEE address written; restart to finish the restore")]
25 RestartRequired,
26 #[error("unknown device {0}")]
28 UnknownDevice(Ieee),
29 #[error("no response from {0:#06x}")]
31 Timeout(NodeId),
32 #[error("delivery to {0:#06x} failed")]
34 DeliveryFailed(NodeId),
35 #[error("{what} failed with status {status:#04x}")]
37 Status {
38 what: String,
40 status: u8,
42 },
43 #[error("bad frame: {0}")]
45 BadFrame(String),
46 #[error("{0}")]
48 Invalid(String),
49 #[error("{0}")]
51 Io(String),
52 #[error("host stopped")]
54 Stopped,
55}
56
57impl From<zigbee_ezsp::EzspError> for HostError {
58 fn from(e: zigbee_ezsp::EzspError) -> Self {
59 HostError::Ncp(e.to_string())
60 }
61}