use librashader_common::map::ShortString;
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 {0:?} was not found during resolution {1:?}")]
IOError(PathBuf, std::io::Error),
#[error(
"a known encoding was not found for the file {0:?}. supported encodings are UTF-8 and Latin-1"
)]
EncodingError(PathBuf),
#[error("unexpected end of file")]
UnexpectedEof,
#[error("unexpected end of line at line {0}")]
UnexpectedEol(usize),
#[error("error parsing pragma {0}")]
PragmaParseError(String),
#[error("duplicate pragma {0} found")]
DuplicatePragmaError(ShortString),
#[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!()
}
}