librashader/librashader-preprocess/src/error.rs
2022-11-21 16:21:50 -05:00

30 lines
827 B
Rust

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("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")]
UnknownShaderFormat,
#[error("stage must be either vertex or fragment")]
InvalidStage,
}
impl From<Infallible> for PreprocessError {
fn from(_: Infallible) -> Self {
unreachable!()
}
}