Deprecate print_error function and replace it with new print_error_and_exit function#5092
Open
Flamefire wants to merge 8 commits intoeasybuilders:developfrom
Open
Deprecate print_error function and replace it with new print_error_and_exit function#5092Flamefire wants to merge 8 commits intoeasybuilders:developfrom
print_error function and replace it with new print_error_and_exit function#5092Flamefire wants to merge 8 commits intoeasybuilders:developfrom
Conversation
There is a `print_error` function in `output` and this one additionally exits which is not reflected in the name. Also the handling of the parameters is confusing, e.g. using `log` to determine whether to throw an `EasyBuildError`. Deprecate it and replace by `print_error_and_exit`, translating the arguments from one to the other.
Only used in one place and all error logging should happen in the constructor of `EasyBuildError` since easybuilders#1218
print_error by print_error_and_exit
print_error by print_error_and_exitprint_error function and replace it with new print_error_and_exit function
boegel
requested changes
Jan 14, 2026
| if testing: | ||
| raise EasyBuildError(msg) | ||
| eb_go.parser.print_shorthelp() | ||
| print_error_and_exit(msg) |
Member
There was a problem hiding this comment.
End out produced output will look like this:
All long option names can be passed as environment variables. Variable name is
EASYBUILD_<LONGNAME> eg. --some-opt is same as setting EASYBUILD_SOME_OPT in
the environment.
ERROR: Please provide one or multiple easyconfig files, or use software build options to make EasyBuild search for easyconfigs
So the error message "drowns" a bit because it blends in with the short help output.
Let's add one (or two) newlines in between?
Contributor
Author
There was a problem hiding this comment.
Note that this was the case before.
We have output.print_error which adds a newline before and after the message. Would be great if we could use that. A bit confusing that print_error are in output but print_msg and print_warning in build_log. I'd move all to one of them but we can't as we either get a cycle or break backwards compat with build_log.print_error (which used to exit)
I'm now calling output.print_error from here to have a uniform appearance of printed errors.
Co-authored-by: Kenneth Hoste <kenneth.hoste@ugent.be>
Use `easybuild.tools.print_error` for a uniform appearance
This is called in error handlers and using `rich` can cause errors.
Co-authored-by: Kenneth Hoste <kenneth.hoste@ugent.be>
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.
There is a
print_errorfunction inoutputand this one additionallyexits which is not reflected in the name.
Also the handling of the parameters is confusing, e.g. using
logtodetermine whether to throw an
EasyBuildError.Deprecate it and replace by
print_error_and_exit, translating thearguments from one to the other.
CI error is due to use of
log.errorwhich is disallowed since #1218Only
easybuild.baseseems to be exempted with a comment (which seems to be outdated)That is also the source of the weird construct:
TBH I don't really like having
EasyBuildErrorlog an error in all cases as we sometimes catch it and do something else instead. But maybe this just means we should not raise it so often.I removed the
logparameter (again)