-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jinja2: removed excessive context from Jinja2 raise/assert statements #6289
Conversation
0ca0ce4
to
3661158
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, couple of related but simple test failures.
3661158
to
7f4e4a5
Compare
|
7f4e4a5
to
9c88c5c
Compare
(Dammit, thought I'd removed that) |
[Not a blocker for this PR] FAILED tests/functional/test_pre_configure.py::test_validate_fail[template variable not set] - assert [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really, really good idea IMO.
Of course, I completely forgot those tests were using |
Merging with two approvals. |
User request: Make the Jinja2
raise
/assert
exceptions cleaner.The
raise
andassert
helpers are used by some workflow developers to allow validation of inputs / environment, e.g:The workflow developer configures the condition and a user-friendly message to display.
Unfortunately, that message gets lost in the resulting message:
This scary looking error makes it look like something is genuinely wrong:
Jinja2Error
exception makes it look like an error.This PR changes the exception from Jinja2Error to InputError and remove the extraneous context:
The full exception is still available to workflows developers in verbose mode (can be helpful in tracking down the location of the
assert
/raise
statement that caused the error).Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).?.?.x
branch.