-
Notifications
You must be signed in to change notification settings - Fork 263
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
Return error message when using --untag with nonexistent tag #880
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4e785cf
return error message from using --untag with nonexistent tag
danielhelfand 07a0e2f
improve err message for --untag and add e2e test
danielhelfand de2c466
change untagRevision to return bool and add traffic e2e tests
danielhelfand 4903bde
update changelog
danielhelfand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
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'd suggest to change this to (please add the import, too, if missing0:
It's always very fragile to assert on the exact wording of something, which might slight improvements tedious to work on (as then always a test needs to be fixed). Instead, just check that the important context information is contained in the error message. This focus also having good error message which as much context information as possible to help a user to understand and fix the error. E.g. Here you could also add the service name which would help the user to understand which service you wanted to tag. The more context, the better.
Also, please use error message according to the golang standard: Starting lower case, no punctuation at the need. The "Error:" prefix is also redundant here (its an error anyway), and in fact the top-level routine which prints the error will add the error prefix anyway. So better remove it here, too.
We have an issues open (not sure where), where we want to check for all error messages to be consistently following this rule. Might be a good exercise to automate that and make it part of the build process.
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.
Just to clarify here, the
error:
prefix won't be added unless included in the message it seems:If you remove
silenceErrors
, Cobra will handle errors without needing to print the error inmain.go
as is done now:I think it makes sense to revisit this by changing how
kn
handles errors.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.
Totally agree, that a consistent error handling is missing, but for consistency's sake, I think there should be a single point which prepares an error message for print out.
In fact, in the refactoring in #877 there is a single exit point in case of a custom error, that now adds the appropriate prefix -->
client/cmd/kn/main.go
Lines 38 to 41 in a71cc3f
We can more error messaging mangling at this point (like uppercasing the first letter), but if we assume that the change above gets merged, then we should already avoid an
Error:
prefix.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.
But don't let that block this PR as we have to go over all error messages later anyway.