-
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
Improve reporting for missing kubeconfig and error connecting to the cluster #725
Conversation
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.
@navidshaikh: 1 warning.
In response to this:
Fixes #315
Description
- Improve error reporting if
- kubeconfig file is missing or
- there is no route to host
- i/o timeout
/lint
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.
Fixes knative#315 - Improve error reporting if - kubeconfig file is missing or - there is no route to host - i/o timeout
The following is the coverage report on the affected files.
|
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.
looks good in general, but I wonder whether there is a more robust way to detect error types ? Parsing error message looks very fragile to me.
We can improve on this if we find a better way.
/lgtm
return NewKNError(msg) | ||
} | ||
|
||
func newNoRouteToHost(errString string) error { |
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 would add an "Error" suffix to the method name (same below)
return false | ||
} | ||
|
||
func isNoRouteToHostError(err error) bool { | ||
return strings.Contains(err.Error(), "no route to host") || strings.Contains(err.Error(), "i/o timeout") |
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.
basing actions on error descriptions is quite fragile. I wonder whether there is a better, typed approach ?
We can also think about it later.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: navidshaikh, rhuss The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is great :) Thank you so much! |
let error message be meaningful instead of showing binary string
Fixes #315
Description
/lint