meh_asus/debugfs/
error.rs1use std::num::ParseIntError;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
13pub enum HardwareError {
14 #[error("Dev ID setup error: {0}")]
15 DevIdFileError(#[from] DevIdFileError),
16
17 #[error("Control Param Error: {0}")]
18 CtrlParamError(#[from] CtrlParamError),
19
20 #[error("Config Apply Error: {0}")]
21 ConfigApplyError(#[from] ConfigApplyError),
22
23 #[error("Devs Config File Error: {0}")]
24 DevsConfigFileError(#[from] DevsConfigFileError),
25
26 #[error("Dsts Config File Error: {0}")]
27 DstsConfigFileError(#[from] DstsConfigFileError),
28
29 #[error("State Error: {0}")]
30 StateError(#[from] StateError),
31}
32
33#[derive(Debug, Error)]
34pub enum DevIdFileError {
35 #[error("Failed to write dev_id! {error}")]
36 WriteFailed { error: std::io::Error },
37}
38
39#[derive(Debug, Error)]
40pub enum CtrlParamError {
41 #[error("Failed to write applied config! {error}")]
42 WriteFailed { error: std::io::Error },
43}
44
45#[derive(Debug, Error)]
46pub enum ConfigApplyError {
47 #[error("Failed to apply the given config! {error}")]
48 ConfigApplyFailed { error: std::io::Error },
49}
50
51#[derive(Debug, Error)]
52pub enum DevsConfigFileError {
53 #[error("Cannot read the config due to unexpected format!\nExpected: `DEVS({}, {{some_value}}) = {{some_value}}\nFound: {value}", dev_id)]
54 UnexpectedConfigFormat { value: String, dev_id: u64 },
55
56 #[error("The given string `{value}` cannot be interpreted as hexadecimal value! {error}")]
57 InvalidHexadecimalValue { value: String, error: ParseIntError },
58}
59
60#[derive(Debug, Error)]
61pub enum StateError {
62 #[error("The state value `{value}` is not listed as a possible state for the hardware!\nPlease initialize the hardware with set of correct possible states, without this type safety cannot be guaranteed.")]
63 NotPossibleState { value: u64 },
64}
65
66
67#[derive(Debug, Error)]
68pub enum DstsConfigFileError {
69 #[error("Cannot read the config due to unexpected format!\nExpected: `DEVS({}, {{some_value}}) = {{some_value}}\nFound: {value}", dev_id)]
70 UnexpectedConfigFormat { value: String, dev_id: u64 },
71
72 #[error("The given string `{value}` cannot be interpreted as hexadecimal value! {error}")]
73 InvalidHexadecimalValue { value: String, error: ParseIntError },
74
75 #[error("Failed to read the currect config file! {error}")]
76 StateReadFailed { error: std::io::Error },
77}