Skip to content

Commit 20f33cc

Browse files
authored
Merge pull request #8333 from fabriziopandini/remove-uid-from-errormsg
🐛 Drop uid from error messages
2 parents 8ecf669 + 6d39d62 commit 20f33cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/controllers/topology/cluster/patches/inline/json_patch_generator.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func (j *jsonPatchGenerator) Generate(_ context.Context, _ client.Object, req *r
6161
errs := []error{}
6262
for i := range req.Items {
6363
item := &req.Items[i]
64+
objectKind := item.Object.Object.GetObjectKind().GroupVersionKind().Kind
6465

6566
templateVariables := patchvariables.ToMap(item.Variables)
6667

@@ -81,13 +82,13 @@ func (j *jsonPatchGenerator) Generate(_ context.Context, _ client.Object, req *r
8182
// Merge template-specific and global variables.
8283
variables, err := patchvariables.MergeVariableMaps(globalVariables, templateVariables)
8384
if err != nil {
84-
errs = append(errs, errors.Wrapf(err, "failed to merge global and template-specific variables for item with uid %q", item.UID))
85+
errs = append(errs, errors.Wrapf(err, "failed to merge global and template-specific variables for %q", objectKind))
8586
continue
8687
}
8788

8889
enabled, err := patchIsEnabled(j.patch.EnabledIf, variables)
8990
if err != nil {
90-
errs = append(errs, errors.Wrapf(err, "failed to calculate if patch %s is enabled for item with uid %q", j.patch.Name, item.UID))
91+
errs = append(errs, errors.Wrapf(err, "failed to calculate if patch is enabled for %q", objectKind))
9192
continue
9293
}
9394
if !enabled {
@@ -100,7 +101,7 @@ func (j *jsonPatchGenerator) Generate(_ context.Context, _ client.Object, req *r
100101
// Generate JSON patches.
101102
jsonPatches, err := generateJSONPatches(patch.JSONPatches, variables)
102103
if err != nil {
103-
errs = append(errs, errors.Wrapf(err, "failed to generate JSON patches for item with uid %q", item.UID))
104+
errs = append(errs, errors.Wrapf(err, "failed to generate JSON patches for %q", objectKind))
104105
continue
105106
}
106107

0 commit comments

Comments
 (0)