Commit 9d41a0a0 authored by Tom Niget's avatar Tom Niget

Handle invalid nodes in exception display

parent d258d294
import ast
from dataclasses import dataclass
from transpiler.utils import UnsupportedNodeError
......@@ -10,12 +14,20 @@ class NodeVisitorSeq:
else:
for parent in node.__class__.__mro__:
if visitor := getattr(self, 'visit_' + parent.__name__, None):
try:
return visitor(node)
except Exception as e:
raise
#raise IncompatibleTypesError(f"{e} in `{ast.unparse(node)}`")
else:
self.missing_impl(node)
def missing_impl(self, node):
raise UnsupportedNodeError(node)
try:
raise UnsupportedNodeError(str(node))
except Exception as e:
raise NotImplementedError(type(node))
@dataclass
class PlainBlock(ast.stmt):
body: list[ast.stmt]
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment