1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use thiserror::Error;
#[derive(Error, Debug, PartialEq, Eq)]
pub enum RsysError {
#[error("Failed to execute command - `{0}`")]
CommandRunError(String),
#[error("Failed to parse command output - `{0}`")]
CommandParseError(String),
#[error("Failed to read a file at `{0}` - `{1}`")]
FileReadError(String, String),
#[error("Failed to aquire local time - `{0}`")]
TimeError(String),
#[error("Failed to parse value from input `{0}` - `{1}`")]
InvalidInputError(String, String),
#[error("Failed to {0} from system - `{1}`")]
SystemError(String, String),
#[cfg(target_os = "windows")]
#[error("Failed to communicate with Win32 api. Error code: `{0}`, Reason: `{1}`")]
WinApiError(u32, String),
}
pub type RsysResult<T> = std::result::Result<T, RsysError>;