remove error wrapping from builder

This commit is contained in:
Ivo Gosemann 2024-02-08 09:51:15 +01:00
parent 365cbe1b41
commit e821e0de15
No known key found for this signature in database
2 changed files with 1 additions and 4 deletions

View File

@ -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
}

View File

@ -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")