feat: add error handling for parser loading in basic_lint function

This commit is contained in:
Paul Gauthier 2024-09-09 13:28:04 -07:00 committed by Paul Gauthier (aider)
parent abf6a9db2e
commit 1a6284cb24

View file

@ -209,7 +209,12 @@ def basic_lint(fname, code):
if lang == "typescript":
return
parser = get_parser(lang)
try:
parser = get_parser(lang)
except OSError as err:
print(f"Unable to load parser: {err}")
return
tree = parser.parse(bytes(code, "utf-8"))
errors = traverse_tree(tree.root_node)