1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
7pub enum Error {
8 #[error("IO error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("File error: {path:?}")]
12 File {
13 #[source]
14 source: std::io::Error,
15 path: PathBuf,
16 },
17
18 #[error("File could not be read as UTF8: {0:?}")]
19 ReadUtf8(PathBuf),
20
21 #[error("Include error")]
22 Include {
23 #[from]
24 source: Box<Error>,
25 },
26
27 #[error("Parse error: {0:?}")]
28 Parse(Option<(PathBuf, usize)>),
29
30 #[error("Preprocess error: {0:?}")]
31 Preprocess(Option<(PathBuf, usize)>),
32
33 #[error("Define argument not found: {0}")]
34 DefineArgNotFound(String),
35
36 #[error("Define not found: {0}")]
37 DefineNotFound(String),
38
39 #[error("Define must have argument")]
40 DefineNoArgs(String), #[error("Exceed recursive limit")]
43 ExceedRecursiveLimit,
44
45 #[error("Include line can't have other items")]
46 IncludeLine,
47}