Skip to main content

rsiot/components/cmp_plc/
error.rs

1use crate::{components::shared_tasks, executor::ComponentError};
2
3use super::COMPONENT_NAME;
4
5/// Ошибки cmp_plc
6#[allow(missing_docs)]
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    /// CmpOutput
10    #[error(transparent)]
11    CmpOutput(ComponentError),
12
13    #[error(transparent)]
14    FilterMsgsWithSameData(#[from] shared_tasks::filter_identical_data::Error),
15
16    #[error("{COMPONENT_NAME} | TaskSaveInputInCacheEnd")]
17    TaskSaveInputInCacheEnd,
18
19    #[error("{COMPONENT_NAME} | TokioSyncMpscSend")]
20    TokioSyncMpscSend,
21
22    #[error("TokioTaskJoin: {0}")]
23    TokioTaskJoin(#[from] tokio::task::JoinError),
24
25    #[error(transparent)]
26    ToCmpOutput(#[from] shared_tasks::mpsc_to_msgbus::Error),
27}
28
29impl From<Error> for ComponentError {
30    fn from(value: Error) -> Self {
31        ComponentError::Execution(value.to_string())
32    }
33}