2024-03-27 19:27:11 +01:00
|
|
|
use std::io;
|
|
|
|
|
|
|
|
/// An error that occurred during compilation.
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
|
|
pub enum Error {
|
|
|
|
#[error("An error occurred while reading the file.")]
|
|
|
|
IoError(#[from] io::Error),
|
|
|
|
#[error("An error occured while tokenizing the source code.")]
|
|
|
|
TokenizeError(#[from] crate::lexical::token::TokenizeError),
|
2024-03-27 21:39:56 +01:00
|
|
|
#[error("An error occurred while parsing the source code.")]
|
|
|
|
ParseError(#[from] crate::syntax::error::Error),
|
2024-03-28 01:17:17 +01:00
|
|
|
#[error("An error occurred while compiling the source code.")]
|
|
|
|
CompileError(#[from] crate::compile::error::CompileError),
|
2024-03-27 19:27:11 +01:00
|
|
|
#[error("An error occurred")]
|
|
|
|
Other(&'static str),
|
|
|
|
}
|
|
|
|
|
|
|
|
/// A specialized [`Result`] type for this crate.
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|