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
use std::convert::Infallible;
use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum PreprocessError {
#[error("the version header was missing")]
MissingVersionHeader,
#[error("the file was not found during resolution")]
IOError(PathBuf, std::io::Error),
#[error(
"a known encoding was not found for the file. supported encodings are UTF-8 and Latin-1"
)]
EncodingError(PathBuf),
#[error("unexpected end of file")]
UnexpectedEof,
#[error("unexpected end of line")]
UnexpectedEol(usize),
#[error("error parsing pragma")]
PragmaParseError(String),
#[error("duplicate pragma found")]
DuplicatePragmaError(String),
#[error("shader format is unknown or not found")]
UnknownImageFormat,
#[error("stage must be either vertex or fragment")]
InvalidStage,
}
impl From<Infallible> for PreprocessError {
fn from(_: Infallible) -> Self {
unreachable!()
}
}