validate_yaml: Diagnostic improvements - #1593
Merged
Merged
Conversation
broonie
force-pushed
the
validate-logging
branch
from
September 3, 2026 22:02
355b416 to
97402dd
Compare
bhcopeland
reviewed
Sep 3, 2026
broonie
force-pushed
the
validate-logging
branch
from
September 3, 2026 23:05
97402dd to
f73aea0
Compare
Validation failures are reported with exceptions but currently we do not
handle them, instead relying on Python's default unhandled exception
behaviour. As well as being verbose this is actively unhelpful for
exceptions like:
raise ValueError(
f"Key {k} has different values in both dictionaries"
)
where the source for the raise is displayed without any interpolation of
the value, making it hard to understand what validation failed. Instead
handle exceptions by printing them, this isn't terribly sophisticated but
still a step forward in usability. Only do this for exceptions the the
program and it's libraries are currently known to generate in order to
preserve some of the backtrace experience for users if anything new
happens.
Signed-off-by: Mark Brown <broonie@kernel.org>
recursive_merge() can raise ValueError as well as the currently handled YAMLError, handle both so we can tell the user which file we were trying to parse when we ran into trouble. It's less useful than it might be since it doesn't say which file had the original value but we've lost that information by the time we run into trouble. Signed-off-by: Mark Brown <broonie@kernel.org>
broonie
force-pushed
the
validate-logging
branch
from
September 5, 2026 17:49
f73aea0 to
e409238
Compare
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.
A couple of fairly trivial usability improvements for validate_yaml.py.