Skip to content

Commit 8822b1e

Browse files
authored
Include additional info in error messages. (kubernetes-sigs#2271)
This makes it easier to figure out what the actual values should be. Signed-off-by: Marcin Owsiany <[email protected]>
1 parent fde793f commit 8822b1e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/model/resource/resource.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,19 @@ func (r *Resource) Update(other Resource) error {
148148

149149
// Make sure we are not merging resources for different GVKs.
150150
if !r.GVK.IsEqualTo(other.GVK) {
151-
return fmt.Errorf("unable to update a Resource with another with non-matching GVK")
151+
return fmt.Errorf("unable to update a Resource (GVK %+v) with another with non-matching GVK %+v", r.GVK, other.GVK)
152152
}
153153

154154
if r.Plural != other.Plural {
155-
return fmt.Errorf("unable to update Resource with another with non-matching Plural")
155+
return fmt.Errorf("unable to update Resource (Plural %q) with another with non-matching Plural %q",
156+
r.Plural, other.Plural)
156157
}
157158

158159
if other.Path != "" && r.Path != other.Path {
159160
if r.Path == "" {
160161
r.Path = other.Path
161162
} else {
162-
return fmt.Errorf("unable to update Resource with another with non-matching Path")
163+
return fmt.Errorf("unable to update Resource (Path %q) with another with non-matching Path %q", r.Path, other.Path)
163164
}
164165
}
165166

0 commit comments

Comments
 (0)