1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use thiserror::Error;
use tera::Error as TeraError;
use toml::de::Error as DeError;
#[derive(Debug, Error)]
pub enum Error {
    #[error("Parser Error: {0}")]
    ParserError(String),
    #[error("File I/O: {0}")]
    FileIOError(#[from] std::io::Error),
    #[error("{0}")]
    HtmlMinifyError(String),
    #[error("Condition failed")]
    PageCheckError,
    #[error("Html rewriting error {0}")]
    HtmlRewriteError(#[from] lol_html::errors::RewritingError),
    #[error("{0} failed while doing {1}")]
    ThreadFailed(String, String),
    #[error("{0}")]
    FileSystemWatchError(#[from] hotwatch::Error),
    #[error("Error while sending message from a thread.")]
    MsgError,
    #[error("Error while receiving message from a thread.")]
    RecvError,
    #[error("Fs Error: {0}")]
    FsError(#[from] fs_extra::error::Error),
    #[error("Config file error: {0}")]
    ConfigFileError(#[from] ConfigError),
    #[error("There is a `restic-markdown` tag without the file attribute.")]
    ResticMarkdownEmpty,
    #[error("Tera Template Error: {0}")]
    TeraError(#[from] TeraError),
    #[error("Template Error: {0}")]
    TemplateError(#[from] TemplateError),
    #[error("Essential folder does not exist: {0}")]
    EssentialFolderNotExist(String)

}

#[derive(Debug, Error)]
pub enum TemplateError {
    #[error("Invalid Expression: {0}")]
    InvalidExpression(String),
    #[error("Invalid Data Type Used: {0}")]
    InvalidValueTypeInDataFile(String)
}


#[derive(Debug, Error)]
pub enum ConfigError {
    #[error("{0}")]
    ConfigFileNotFound(String),
    #[error("Required Field: {0}")]
    ConfigFileRequiredField(#[from] DeError),
    #[error("Parse Error: {0}")]
    ConfigFileParseError(String)
}