resources: Panic on Copy of Resource with .Err

Fixes #10006
This commit is contained in:
Bjørn Erik Pedersen 2022-06-13 16:33:41 +02:00
parent 5a9ecb82a3
commit 66da1b7b2f

View file

@ -128,6 +128,9 @@ type resourceCopier interface {
// Copy copies r to the targetPath given. // Copy copies r to the targetPath given.
func Copy(r resource.Resource, targetPath string) resource.Resource { func Copy(r resource.Resource, targetPath string) resource.Resource {
if r.Err() != nil {
panic(fmt.Sprintf("Resource has an .Err: %s", r.Err()))
}
return r.(resourceCopier).cloneTo(targetPath) return r.(resourceCopier).cloneTo(targetPath)
} }