Repository navigation
Improve the error message when invalid combination - #5566
Conversation
This PR is basically same idea with the fix of knative#5382. When invalid combination is configured, the ErrInvalidValue is printed for now. It is not accurate message and will mislead users. To fix it, this patch prints accurate message with ErrGeneric.
knative-prow-robot
left a comment
There was a problem hiding this comment.
@nak3: 0 warnings.
Details
In response to this:
Proposed Changes
This PR is basically same idea with the fix of #5382.
When invalid combination is configured, the ErrInvalidValue is printed for now.
It is not accurate message and will mislead users.To fix it, this patch prints accurate message with ErrGeneric.
BEFORE:
invalid value: true: spec.traffic[0].latestRevisionAFTER:
May not set revisionName "hello-example-dk7nd" when latestRevision is true: spec.traffic[0].latestRevisionfor following combination.
traffic: - latestRevision: true revisionName: hello-example-dk7nd percent: 100Also, ref: knative/pkg#638
/lint
Release Note
NONE
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
markusthoemmes
left a comment
There was a problem hiding this comment.
I personally like it a lot more than what we currently have.
/assign @dgerd
| // The senses for whether to pin to a particular revision or | ||
| // float forward to the latest revision must match. | ||
| return apis.ErrInvalidValue(lr, "latestRevision") | ||
| return apis.ErrGeneric(fmt.Sprintf("May not set revisionName %q when latestRevision is %t", tt.RevisionName, lr), "latestRevision") |
There was a problem hiding this comment.
Errors should always start with a lowercase character (I can't my source for it 😂, maybe you just trust me?). It's to aid readability on composed errors.
There was a problem hiding this comment.
Yes, the log should always start with a lowercase character (I also cannot find the source, but it should be.) Thank you. Updated.
|
/assign @dgerd |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgerd, markusthoemmes, nak3, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Proposed Changes
This PR is basically same idea with the fix of #5382.
When invalid combination is configured, the ErrInvalidValue is printed for now.
It is not accurate message and will mislead users.
To fix it, this patch prints accurate message with ErrGeneric.
BEFORE:
AFTER:
for following combination.
Also, ref: knative/pkg#638
/lint
Release Note