Skip to content

Commit 06773c8

Browse files
add error message
1 parent 1e3d775 commit 06773c8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pythonbpf/vmlinux_parser/vmlinux_class_handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
logger = logging.getLogger(__name__)
1010

11+
1112
@lru_cache(maxsize=1)
1213
def get_module_symbols(module_name: str):
1314
imported_module = importlib.import_module(module_name)
1415
return [name for name in dir(imported_module)], imported_module
1516

17+
1618
# Recursive function that gets all the dependent classes and adds them to handler
1719
def process_vmlinux_class(node, llvm_module, handler: DependencyHandler):
1820
symbols_in_module, imported_module = get_module_symbols("vmlinux")
@@ -64,11 +66,12 @@ def process_vmlinux_class(node, llvm_module, handler: DependencyHandler):
6466
elif module_name == "vmlinux":
6567
new_dep_node.add_field(elem_name, elem_type, ready=False)
6668
# Create a temporary node-like object for recursion
67-
temp_node = type('TempNode', (), {'name': elem_type.__name__ if hasattr(elem_type, '__name__') else str(elem_type)})()
69+
temp_node = type('TempNode', (),
70+
{'name': elem_type.__name__ if hasattr(elem_type, '__name__') else str(elem_type)})()
6871
if process_vmlinux_class(temp_node, llvm_module, handler):
6972
new_dep_node.set_field_ready(elem_name, True)
7073
else:
71-
print(f"[other] {elem_name} -> {elem_type}")
74+
raise ValueError(f"{elem_name} with type {elem_type} not supported in recursive resolver")
7275
handler.add_node(new_dep_node)
7376

7477
return True

0 commit comments

Comments
 (0)