Skip to content

Commit 9788e20

Browse files
committed
add some more error handling
1 parent d9cc229 commit 9788e20

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/objdictgen/node.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ def executeCustomGenerator(filename: str, filepath: TPath, node: NodeProtocol):
4141
spec = importlib.util.spec_from_file_location("CustomGenerator", filename)
4242
customModule = importlib.util.module_from_spec(spec)
4343
sys.modules["CustomGenerator"] = customModule
44-
spec.loader.exec_module(customModule)
44+
# Handle errors coming from custom code
45+
try:
46+
spec.loader.exec_module(customModule)
47+
except Exception as e:
48+
print(f"error executing {filename}: {e}")
49+
return
4550

4651
if hasattr(customModule, 'GenerateFile'):
4752
return customModule.GenerateFile(filepath, node)

0 commit comments

Comments
 (0)