prevent printing usages on error#457
Merged
nabuskey merged 1 commit intocnoe-io:mainfrom Nov 22, 2024
Merged
Conversation
Signed-off-by: Manabu McCloskey <manabu.mccloskey@gmail.com>
cmoulliard
approved these changes
Nov 22, 2024
Contributor
cmoulliard
left a comment
There was a problem hiding this comment.
I did a test where I provided a wrong package to the command
Before:
❯ ./idpbuilder get secrets -p argocdddd
Error: listing secrets: failed to get API group resources: unable to retrieve the complete list of server APIs: v1: Get "https://127.0.0.1:51605/api/v1": dial tcp 127.0.0.1:51605: connect: connection refused
Usage:
idpbuilder get secrets [flags]
Flags:
-h, --help help for secrets
Global Flags:
--color Enable colored log messages.
-l, --log-level string Set the log verbosity. Supported values are: debug, info, warn, and error. (default "info")
-o, --output string Output format. json or yaml.
-p, --packages strings names of packages.
listing secrets: failed to get API group resources: unable to retrieve the complete list of server APIs: v1: Get "https://127.0.0.1:51605/api/v1": dial tcp 127.0.0.1:51605: connect: connection refused
After:
❯ ./idpbuilder get secrets -p argocdddd
Error: listing secrets: failed to get API group resources: unable to retrieve the complete list of server APIs: v1: Get "https://127.0.0.1:51605/api/v1": dial tcp 127.0.0.1:51605: connect: connection refused
listing secrets: failed to get API group resources: unable to retrieve the complete list of server APIs: v1: Get "https://127.0.0.1:51605/api/v1": dial tcp 127.0.0.1:51605: connect: connection refused
Note: We should review how we log messages too as error is reported twice. This ticket could be used for that purpose: #450
Collaborator
Author
|
Yeah we should definitely look into why errors are being printed twice. |
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.
Set
SilenceUsage: true,for commands to prevent usages from being printed every time an error occurs.before:
After:
fixes: #439