librashader_preprocess/
error.rs1use librashader_common::map::ShortString;
2use std::convert::Infallible;
3use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum PreprocessError {
9 #[error("the version header was missing")]
11 MissingVersionHeader,
12 #[error("the file was not found during resolution")]
14 IOError(PathBuf, std::io::Error),
15 #[error(
17 "a known encoding was not found for the file. supported encodings are UTF-8 and Latin-1"
18 )]
19 EncodingError(PathBuf),
20 #[error("unexpected end of file")]
22 UnexpectedEof,
23 #[error("unexpected end of line")]
25 UnexpectedEol(usize),
26 #[error("error parsing pragma")]
28 PragmaParseError(String),
29 #[error("duplicate pragma found")]
31 DuplicatePragmaError(ShortString),
32 #[error("shader format is unknown or not found")]
34 UnknownImageFormat,
35 #[error("stage must be either vertex or fragment")]
37 InvalidStage,
38}
39
40impl From<Infallible> for PreprocessError {
41 fn from(_: Infallible) -> Self {
42 unreachable!()
43 }
44}