Merge pull request #77009 from soltysh/fix_error

Make the error slightly more readable
k3s-v1.15.3
Kubernetes Prow Robot 2019-04-24 14:21:20 -07:00 committed by GitHub
commit 43fb2b342c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -132,6 +132,9 @@ func checkErr(err error, handleErr func(string, int)) {
case kerrors.IsInvalid(err):
details := err.(*kerrors.StatusError).Status().Details
s := fmt.Sprintf("The %s %q is invalid", details.Kind, details.Name)
if len(details.Kind) == 0 && len(details.Name) == 0 {
s = "The request is invalid"
}
if len(details.Causes) > 0 {
errs := statusCausesToAggrError(details.Causes)
handleErr(MultilineError(s+": ", errs), DefaultErrorExitCode)