From e821e0de15ea45be5885088d4a08ea9aaba2b184 Mon Sep 17 00:00:00 2001 From: Ivo Gosemann Date: Thu, 8 Feb 2024 09:51:15 +0100 Subject: [PATCH] remove error wrapping from builder --- staging/src/k8s.io/cli-runtime/pkg/resource/builder.go | 2 +- staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go b/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go index 36a9b3f2f26..47ec83bbbad 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go +++ b/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go @@ -803,7 +803,7 @@ func (b *Builder) mappingFor(resourceOrKindArg string) (*meta.RESTMapping, error // if the error is _not_ a *meta.NoKindMatchError, then we had trouble doing discovery, // so we should return the original error since it may help a user diagnose what is actually wrong if meta.IsNoMatchError(err) { - return nil, fmt.Errorf("the server doesn't have a resource type %q: %w", groupResource.Resource, err) + return nil, fmt.Errorf("the server doesn't have a resource type %q", groupResource.Resource) } return nil, err } diff --git a/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go b/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go index 460bfee4551..3ec23461ece 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go +++ b/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go @@ -1053,9 +1053,6 @@ func TestRestMappingErrors(t *testing.T) { if !strings.Contains(err.Error(), "server doesn't have a resource type \"foo\"") { t.Fatalf("unexpected error: %v", err) } - if !errors.Is(err, &meta.NoKindMatchError{}) { - t.Fatalf("unexpected error type: %v", err) - } } expectedErr := fmt.Errorf("expected error")