Skip to content

Show generator values if generator errors#541

Merged
ducky64 merged 3 commits into
masterfrom
generator-error
Jul 23, 2026
Merged

Show generator values if generator errors#541
ducky64 merged 3 commits into
masterfrom
generator-error

Conversation

@ducky64

@ducky64 ducky64 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Resolves #540


Contributor License Agreement

By submitting this pull request, I agree to dual-license this contribution under both BSD 3-clause and Apache License, Version 2.0.

  • I agree to dual-license this contribution under both BSD 3-clause and Apache License, Version 2.0.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves debuggability of GeneratorBlock.generate() failures by surfacing generator parameter values alongside generator exceptions, addressing issue #540 (“Dump generator params on generator errors”).

Changes:

  • Wraps exceptions raised from GeneratorBlock.generate() to add generator parameter name/value context.
  • Adds a regression test that exercises a generator throwing during generate().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
edg/core/Generator.py Wraps generate() errors to include generator parameter values in the surfaced exception message.
edg/core/test_generator_error.py Adds a test generator that raises during generate() and a compile-time failure test case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread edg/core/Generator.py
Comment on lines +148 to +154
params_list_str = ", ".join(
f"{self._name_of_child(param, self, allow_unknown=True)}={self._generator_param_values[param]}"
for param in self._generator_params_list
)
raise RuntimeError(
f"Generator {self.__class__.__name__} with parameters {{{params_list_str}}} raised exception"
) from e
Comment on lines +52 to +54
def test_generator_raises(self) -> None:
with self.assertRaises(CompilerCheckError):
ScalaCompiler.compile(GeneratorErrorTop)
@ducky64
ducky64 merged commit 9c69857 into master Jul 23, 2026
13 checks passed
@ducky64
ducky64 deleted the generator-error branch July 23, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dump generator params on generator errors

2 participants