rsiot/components/cmp_esp_spi_master/
error.rs

1use crate::{components::shared_tasks, components_config::master_device, executor::ComponentError};
2
3#[allow(missing_docs)]
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    #[error("CmpOutput: {0}")]
7    CmpOutput(ComponentError),
8
9    #[error("FnOutput: {0}")]
10    FnInput(anyhow::Error),
11
12    #[error("FnOutput: {0}")]
13    FnOutput(anyhow::Error),
14
15    #[error("TokioTaskJoin: {0}")]
16    TokioTaskJoin(#[from] tokio::task::JoinError),
17
18    #[error(transparent)]
19    TaskMpscToMsgBus(shared_tasks::mpsc_to_msgbus::Error),
20
21    #[error(transparent)]
22    TaskFilter(shared_tasks::filter_identical_data::Error),
23
24    #[error(transparent)]
25    TaskMsgbusToBroadcast(shared_tasks::msgbus_to_broadcast::Error),
26
27    #[error(transparent)]
28    DeviceError(#[from] master_device::Error),
29
30    #[error("CS number {cs} not availbalve; amount of configured CS: {max_cs}")]
31    CsNotAvailable { cs: u8, max_cs: u8 },
32
33    #[error("TokioMpscSend")]
34    TokioMpscSend,
35}
36
37impl From<Error> for ComponentError {
38    fn from(value: Error) -> Self {
39        ComponentError::Execution(value.to_string())
40    }
41}