-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
fix: properly report errors when lock file cannot be parsed #2020
base: main
Are you sure you want to change the base?
Conversation
The function returns only 4 arguments upon errors, but 5 are expected and returned when everything succeeded.
7d5af4b
to
8d2043a
Compare
|
@@ -531,12 +531,12 @@ def _parse_lockfile(parsed, err): | |||
A tuple of (importers dict, packages dict, patched_dependencies dict, error string) | |||
""" | |||
if err != None or parsed == None or parsed == {}: | |||
return {}, {}, {}, err | |||
return {}, {}, {}, -1, err if err != None else "could not parse Yaml config" |
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.
I'm confused, you now return a 5-tuple instead of a 4-tuple, doesn't that require changes at the callsites?
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.
The call sites already expect 5-tuple 😄 — they never see the invalid 4-tuple though because of no errors most of the time
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.
I see, do you mind correcting the Returns
doc above in that case?
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 change looks correct, where the -1
is the lockfileVersion
.
However I don't think we should have the default "could not parse Yaml config"
since I think an empty lockfile is valid? The -1
version number is probably still ok in that case.
Can we add a test for that case that failed previously?
@devversion have a chance to fix the build errors? Potentially add a test if you have time... |
The function returns only 4 arguments upon errors, but 5 are expected and returned when everything succeeded.