Skip to content

Improve CLI error messages#3259

Merged
koesie10 merged 4 commits intomainfrom
koesie10/improve-error-message
Jan 29, 2024
Merged

Improve CLI error messages#3259
koesie10 merged 4 commits intomainfrom
koesie10/improve-error-message

Conversation

@koesie10
Copy link
Copy Markdown
Member

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.

Screenshot 2024-01-19 at 12 11 18

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@koesie10 koesie10 marked this pull request as ready for review January 19, 2024 11:26
@koesie10 koesie10 requested a review from a team as a code owner January 19, 2024 11:26
@koesie10 koesie10 requested a review from a team January 19, 2024 11:27
void showAndLogWarningMessage(logger, errorMessage.fullMessage);
}
} else if (e instanceof CliError) {
const fullMessage = `${e.commandDescription} failed with args:${EOL}${
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@koesie10 koesie10 merged commit 978e48f into main Jan 29, 2024
@koesie10 koesie10 deleted the koesie10/improve-error-message branch January 29, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants