-
Notifications
You must be signed in to change notification settings - Fork 125
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
commands: Show less generic error when no manifest is loaded #671
base: main
Are you sure you want to change the base?
Conversation
If loading the manifest fails, running a command which needs to read the manifest could result in this being shown: FATAL ERROR: can't run west manifest; it requires the manifest, which was not available. Try "west manifest --validate" to debug. In this case, trying "west manifest --validate" would also display the same error, which is not very helpful. Instead of that, west can print the deferred error from load_manifest(), which contains a more specific message. Rework the WestCommand.manifest property handling by adding a dummy _ManifestRequired exception. It is caught by run_builtin() in main.py, which can access the stored error. Signed-off-by: Grzegorz Swiderski <[email protected]>
@mbolivar-nordic Hi, I can't add you as reviewer, but do you want to look over this? |
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 think this should probably be handled in the relevant built-in commands themselves by checking WestCommand.has_manifest
and erroring out as necessary. Did you consider this? If so, why did you reject it?
Yes, I had briefly considered it, but I figured it would probably involve passing I'm fine with per-command handling, if you prefer, since it looks like only In fact, on second thought, the easiest fix for Lines 277 to 283 in 9e8f500
since it will always bail without a manifest: Lines 547 to 548 in 9e8f500
|
However I tried with a totally different project and as of the current west version 0612a6d the issue does not seem to have changed. Considering Marti left the project, I have successfully tested a much simpler and zero-risk "fix" similar to 45762a0 diff --git a/src/west/app/main.py b/src/west/app/main.py
index 2b4addb03e2d..b678893911f1 100755
--- a/src/west/app/main.py
+++ b/src/west/app/main.py
@@ -917,7 +917,7 @@ class WestArgumentParser(argparse.ArgumentParser):
# warn them again.
append('Cannot load extension commands; '
'help for them is not available.')
- append('(To debug, try: "west manifest --validate".)')
+ append('(To debug, try: "west -vv manifest --validate".)')
append('')
else:
# TODO we may want to be more aggressive about loading
diff --git a/src/west/commands.py b/src/west/commands.py
index 2e5a4b89b555..1abb0fcd17d2 100644
--- a/src/west/commands.py
+++ b/src/west/commands.py
@@ -260,7 +260,7 @@ class WestCommand(ABC):
if self._manifest is None:
self.die(f"can't run west {self.name};",
"it requires the manifest, which was not available.",
- 'Try "west manifest --validate" to debug.')
+ 'Try "west -vv manifest --validate" to debug.')
return self._manifest
def _set_manifest(self, manifest: Optional[Manifest]): |
It seems natural to recommend "debug" flags when telling the user to "debug". More specifically, this makes a big difference in situations like the one reported in zephyrproject-rtos#671 Signed-off-by: Marc Herbert <[email protected]>
Minor EDIT: merged. |
It seems natural to recommend "debug" flags when telling the user to "debug". More specifically, this makes a big difference in situations like the one reported in #671 Signed-off-by: Marc Herbert <[email protected]>
This change is located in a fairly complex area little or no test coverage: error handling. I don't have the time to learn about it but I don't think the value is worth the risk. My 2 cents, sorry. |
I'll move it out of the 1.3 list for now. |
Minor quirk that stuck out to me while testing the recent changes. Before 23db6e1, if I were to try
west manifest --resolve
in Zephyr without cloningbsim
, I would see this:which is helpful enough. Now, this generic message gets displayed:
Ironically,
west manifest --validate
produces the same error, which is not very helpful. So, I tried to fix that.