fix(unikraft): preserve underlying error details on version parse failure - #951
Open
KHARSHAVARDHAN-eng wants to merge 1 commit into
Open
Conversation
…lure
When u.Version failed to parse, configureUnikraftArgs() previously discarded
the underlying error and returned only generic ErrVersionParsing.
Wrap the original parsing error with ErrVersionParsing (fmt.Errorf("%w: %w", ...))
to expose the root cause details while maintaining errors.Is compatibility with
ErrVersionParsing.
Fixes urunc-dev#891
Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
✅ Deploy Preview for urunc canceled.
|
|
Hello @KHARSHAVARDHAN-eng, the changes are correct. However, I don't see the need of adding tests in this PR, test coverage will be handled separately ig. Side note - make sure to not overwrite the PR template. |
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.
Fixes #891
Summary
In
pkg/unikontainers/unikernels/unikraft.go, whenu.Versionfailed to parse,configureUnikraftArgs()previously discarded the underlying error and returned only a genericErrVersionParsing. This masked the exact root cause (such as malformed strings or invalid characters).Solution
configureUnikraftArgs()to wrap the original parsing error:fmt.Errorf("%w: %w", ErrVersionParsing, err).errors.Is(err, ErrVersionParsing)compatibility while surfacing the underlying parse error message to the caller.unikraft_test.gocovering empty, invalid, legacy, and current version strings.