Skip to content

Commit 825cb67

Browse files
committed
Make the error slightly more readable
1 parent 3ba70b9 commit 825cb67

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/kubectl/cmd/util/helpers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ func checkErr(err error, handleErr func(string, int)) {
132132
case kerrors.IsInvalid(err):
133133
details := err.(*kerrors.StatusError).Status().Details
134134
s := fmt.Sprintf("The %s %q is invalid", details.Kind, details.Name)
135+
if len(details.Kind) == 0 && len(details.Name) == 0 {
136+
s = "The request is invalid"
137+
}
135138
if len(details.Causes) > 0 {
136139
errs := statusCausesToAggrError(details.Causes)
137140
handleErr(MultilineError(s+": ", errs), DefaultErrorExitCode)

0 commit comments

Comments
 (0)