rsiot/components/cmp_linux_i2c_master/
error.rs1use crate::{components::shared_tasks, components_config::master_device, executor::ComponentError};
2
3use super::COMPONENT_NAME;
4
5#[allow(missing_docs)]
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("{COMPONENT_NAME} | CmpOutput: {0}")]
9 CmpOutput(ComponentError),
10
11 #[error("{COMPONENT_NAME} | FnInput: {0}")]
12 FnInput(anyhow::Error),
13
14 #[error("{COMPONENT_NAME} | FnOutput: {0}")]
15 FnOutput(anyhow::Error),
16
17 #[error("{COMPONENT_NAME} | DeviceError: {0}")]
18 DeviceError(#[from] master_device::Error),
19
20 #[error("{COMPONENT_NAME} | TaskMpscToMsgBus: {0}")]
21 TaskMpscToMsgBus(shared_tasks::mpsc_to_msgbus::Error),
22
23 #[error("{COMPONENT_NAME} | TaskFilter: {0}")]
24 TaskFilter(shared_tasks::filter_identical_data::Error),
25
26 #[error("{COMPONENT_NAME} | TaskMsgbusToBroadcast: {0}")]
27 TaskMsgbusToBroadcast(shared_tasks::msgbus_to_broadcast::Error),
28
29 #[error("{COMPONENT_NAME} | TokioSyncMpsc")]
30 TokioSyncMpsc,
31
32 #[error("{COMPONENT_NAME} | TokioTaskJoin: {0}")]
33 TokioTaskJoin(#[from] tokio::task::JoinError),
34
35 #[error("{COMPONENT_NAME} | LinuxI2CBusError: {0}")]
36 LinuxI2CBusError(#[from] linux_embedded_hal::i2cdev::linux::LinuxI2CError),
37}
38
39impl From<Error> for ComponentError {
40 fn from(value: Error) -> Self {
41 ComponentError::Execution(value.to_string())
42 }
43}