Skip to main content

rsiot/components/cmp_file_appender/
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} | CreateDirAll: {0}")]
9    CreateDirAll(std::io::Error),
10
11    #[error("{COMPONENT_NAME} | CreateFile: {0}")]
12    CreateFile(std::io::Error),
13
14    #[error("{COMPONENT_NAME} | FlushFile: {0}")]
15    FlushFile(std::io::Error),
16
17    #[error("{COMPONENT_NAME} | WriteAll: {0}")]
18    WriteAllFile(std::io::Error),
19}
20
21impl From<Error> for ComponentError {
22    fn from(value: Error) -> Self {
23        ComponentError::Execution(value.to_string())
24    }
25}