fix code error message not being displayed

This commit is contained in:
Moritz Hölting 2024-08-24 00:46:37 +02:00
parent 8953b347c5
commit 4505def6c0
3 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ pub enum Error {
LexicalError(#[from] crate::lexical::Error), LexicalError(#[from] crate::lexical::Error),
#[error("An error occured while tokenizing the source code.")] #[error("An error occured while tokenizing the source code.")]
TokenizeError(#[from] crate::lexical::token::TokenizeError), TokenizeError(#[from] crate::lexical::token::TokenizeError),
#[error("An error occurred while parsing the source code.")] #[error(transparent)]
ParseError(#[from] crate::syntax::error::Error), ParseError(#[from] crate::syntax::error::Error),
#[error("An error occurred while transpiling the source code.")] #[error("An error occurred while transpiling the source code.")]
TranspileError(#[from] crate::transpile::TranspileError), TranspileError(#[from] crate::transpile::TranspileError),

View File

@ -85,7 +85,7 @@ pub fn parse(
let mut parser = Parser::new(&tokens); let mut parser = Parser::new(&tokens);
let program = parser.parse_program(handler).ok_or(Error::Other( let program = parser.parse_program(handler).ok_or(Error::Other(
"An error occured while parsing the source code.", "An error occurred while parsing the source code.",
))?; ))?;
if handler.has_received() { if handler.has_received() {

View File

@ -87,6 +87,6 @@ impl std::error::Error for UnexpectedSyntax {}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, thiserror::Error)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, thiserror::Error)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum Error { pub enum Error {
#[error("{0}")] #[error(transparent)]
UnexpectedSyntax(#[from] UnexpectedSyntax), UnexpectedSyntax(#[from] UnexpectedSyntax),
} }