From 4505def6c0bc43f9e67274a305453a6ac7ca517f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20H=C3=B6lting?= <87192362+moritz-hoelting@users.noreply.github.com> Date: Sat, 24 Aug 2024 00:46:37 +0200 Subject: [PATCH] fix code error message not being displayed --- src/base/error.rs | 2 +- src/lib.rs | 2 +- src/syntax/error.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/error.rs b/src/base/error.rs index 5c8b776..7a1a61b 100644 --- a/src/base/error.rs +++ b/src/base/error.rs @@ -8,7 +8,7 @@ pub enum Error { LexicalError(#[from] crate::lexical::Error), #[error("An error occured while tokenizing the source code.")] TokenizeError(#[from] crate::lexical::token::TokenizeError), - #[error("An error occurred while parsing the source code.")] + #[error(transparent)] ParseError(#[from] crate::syntax::error::Error), #[error("An error occurred while transpiling the source code.")] TranspileError(#[from] crate::transpile::TranspileError), diff --git a/src/lib.rs b/src/lib.rs index 34743f5..397d73b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,7 +85,7 @@ pub fn parse( let mut parser = Parser::new(&tokens); 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() { diff --git a/src/syntax/error.rs b/src/syntax/error.rs index 7790114..ffcaf84 100644 --- a/src/syntax/error.rs +++ b/src/syntax/error.rs @@ -87,6 +87,6 @@ impl std::error::Error for UnexpectedSyntax {} #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, thiserror::Error)] #[allow(missing_docs)] pub enum Error { - #[error("{0}")] + #[error(transparent)] UnexpectedSyntax(#[from] UnexpectedSyntax), }