-
Notifications
You must be signed in to change notification settings - Fork 193
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
Improve CLI error messages #3259
Conversation
@@ -62,6 +64,16 @@ export function registerCommandWithErrorHandling( | |||
} else { | |||
void showAndLogWarningMessage(logger, errorMessage.fullMessage); | |||
} | |||
} else if (e instanceof CliError) { | |||
const fullMessage = `${e.commandDescription} failed with args:${EOL}${ |
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.
If I'm not mistaken, this message will come out as:
SomeCommand failed with args:
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
stderr stderr stderr stderr stderr stderr stderr stderr
arg1 arg2 arg3
Should the args come before the stderr?
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.
Yes, you're right. I've updated this to be correct.
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.
LGTM
This improves the CLI error messages by trying to parse the stderr if it matches a known exit code. This doesn't handle all cases, but it handles the most common cases. In case another error is returned, it will now simply print the stderr itself, rather than starting with
${description} failed with ${args}:
. This can still be found in the extension logs, and is already printed when starting execution of the command in the extension logs as well.Checklist
ready-for-doc-review
label there.