Skip to main content

rsiot/components/cmp_os_process/
error.rs

1use crate::executor::ComponentError;
2
3use super::COMPONENT_NAME;
4
5#[allow(missing_docs)]
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8    #[error("{COMPONENT_NAME} | EmptyCommand")]
9    EmptyCommand,
10
11    #[error("{COMPONENT_NAME} | CommandExecution. Command:  {command}; error: {error}")]
12    CommandExecution {
13        command: String,
14        error: tokio::io::Error,
15    },
16
17    #[error("{COMPONENT_NAME} | FnProcessEnd")]
18    FnProcessEnd,
19
20    #[error("{COMPONENT_NAME} | TaskCommandEnd")]
21    TaskCommandEnd,
22
23    #[error("{COMPONENT_NAME} | TokioSyncMpscSend")]
24    TokioSyncMpscSend,
25
26    #[error("{COMPONENT_NAME} | TokioTaskJoin: {0}")]
27    TokioTaskJoin(#[from] tokio::task::JoinError),
28
29    #[error("{COMPONENT_NAME} | UnicodeConversion")]
30    UnicodeConversion(#[from] std::string::FromUtf8Error),
31}
32
33impl From<Error> for ComponentError {
34    fn from(value: Error) -> Self {
35        ComponentError::Execution(value.to_string())
36    }
37}