Show generator values if generator errors#541
Merged
Conversation
There was a problem hiding this comment.
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 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.