Files
kustomize/api/internal/localizer/errors.go
Anna Song 06da3b96a2 Localize resources (#4912)
* Localize resources

* Improve readability

* Add integration tests

* Group test helper functions
2023-01-05 08:47:59 -08:00

28 lines
672 B
Go

// Copyright 2022 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package localizer
import "fmt"
type ResourceLoadError struct {
InlineError error
FileError error
}
func (rle ResourceLoadError) Error() string {
return fmt.Sprintf(`when parsing as inline received error: %s
when parsing as filepath received error: %s`, rle.InlineError, rle.FileError)
}
type PathLocalizeError struct {
Path string
FileError error
RootError error
}
func (ple PathLocalizeError) Error() string {
return fmt.Sprintf(`could not localize path %q as file: %s; could not localize path %q as directory: %s`,
ple.Path, ple.FileError, ple.Path, ple.RootError)
}