mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Unwrap aggregates of size 1 when writing errors
Also, only use aggregate in get when we actually are dealing with multiple errors.
This commit is contained in:
@@ -122,6 +122,11 @@ func checkErrWithPrefix(prefix string, err error) {
|
||||
// checkErr formats a given error as a string and calls the passed handleErr
|
||||
// func with that string and an kubectl exit code.
|
||||
func checkErr(prefix string, err error, handleErr func(string, int)) {
|
||||
// unwrap aggregates of 1
|
||||
if agg, ok := err.(utilerrors.Aggregate); ok && len(agg.Errors()) == 1 {
|
||||
err = agg.Errors()[0]
|
||||
}
|
||||
|
||||
switch {
|
||||
case err == nil:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user