From ff08eae77f6d3f375c235b5808c2be6d938fc336 Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Sat, 23 Mar 2024 19:12:31 +0800 Subject: [PATCH] chore: improve syntax error messages (#3885) This commit improves the handling of syntax errors by hiding the underlying exception from the python parser. --- vyper/ast/parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vyper/ast/parse.py b/vyper/ast/parse.py index a4a8617730..690f88d3b5 100644 --- a/vyper/ast/parse.py +++ b/vyper/ast/parse.py @@ -60,7 +60,7 @@ def parse_to_ast_with_settings( py_ast = python_ast.parse(python_source) except SyntaxError as e: # TODO: Ensure 1-to-1 match of source_code:reformatted_code SyntaxErrors - raise SyntaxException(str(e), vyper_source, e.lineno, e.offset) from e + raise SyntaxException(str(e), vyper_source, e.lineno, e.offset) from None # Add dummy function node to ensure local variables are treated as `AnnAssign` # instead of state variables (`VariableDecl`)