thisweek_core/
error.rs

1#[derive(thiserror::Error, Debug)]
2pub enum Error {
3    #[error("can not get OS default application path!")]
4    DefaultAppPathError,
5
6    #[error("this is a ConfigError from toml deserialization!")]
7    ConfigSyntaxError(#[from] toml::de::Error),
8    #[error("the config file not found!")]
9    ConfigNotFoundError,
10    #[error("can not generate toml file")]
11    ConfigTomlGenerateError,
12    #[error("can not save (write) config toml file")]
13    ConfigFileSaveError,
14
15    #[error("provided days range is not correct")]
16    BadDaysRangeError,
17    #[error("provided days range is very long: {} days", self)]
18    LongDaysRangeError(i32),
19
20    #[error("invalid timestamp: sec: {sec}, nano: {nano}")]
21    InvalidTimestampError { sec: i64, nano: u32 },
22
23    #[error("database error: {0}")]
24    DatabaseInsertError(String),
25    #[error("database error: {0}")]
26    DatabaseSelectError(String),
27    #[error("can not copy database file")]
28    DatabaseFileCopyError,
29    #[error("can not create database file")]
30    DatabaseFileCreateError,
31    #[error("can not delete database file")]
32    DatabaseFileRemoveError,
33    #[error("the data file is not valid")]
34    DatabaseFileInvalidError,
35    #[error("the data file is not available")]
36    DatabaseFileDontExistsError,
37    #[error("the file location should be empty")]
38    DatabaseFileNotEmptyError,
39}