Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
add the error message (optional) if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ThakeeNathees committed Jul 30, 2024
1 parent a7f0c71 commit cf72a31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 4 additions & 6 deletions jaclang/compiler/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ def transform(self, ir: ast.AstNode) -> ast.Module:
catch_error.pos_start = e.pos_in_stream or 0
catch_error.pos_end = catch_error.pos_start + 1

# TODO: Based on the lark error generate the message (consice).
# Example:
# Unexpected token, Unexpected End of File,
# Non terminated string literal, Invalid hex number (0x1zfk),
# Expected a semicollon, etc.
self.error("Syntax Error", node_override=catch_error)
error_msg = "Syntax Error"
if len(e.args) >= 1 and isinstance(e.args[0], str):
error_msg += e.args[0]
self.error(error_msg, node_override=catch_error)

except Exception as e:
self.error(f"Internal Error: {e}")
Expand Down
4 changes: 0 additions & 4 deletions jaclang/runtimelib/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ def get_codeobj(

if result.errors_had or not result.ir.gen.py_bytecode:
for alrt in result.errors_had:
# logger.error(
# f"While importing {len(result.errors_had)} errors"
# f" found in {full_target}"
# )
logger.error(alrt.pretty_print())
return None
if result.ir.gen.py_bytecode is not None:
Expand Down

0 comments on commit cf72a31

Please sign in to comment.