| 1 |
// Copyright 2022 The Kubernetes Authors. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package localizer |
| 5 |
|
| 6 |
import "fmt" |
| 7 |
|
| 8 |
type ResourceLoadError struct { |
| 9 |
InlineError error |
| 10 |
FileError error |
| 11 |
} |
| 12 |
|
| 13 |
func (rle ResourceLoadError) Error() string { |
| 14 |
return fmt.Sprintf(`when parsing as inline received error: %s |
| 15 |
when parsing as filepath received error: %s`, rle.InlineError, rle.FileError) |
| 16 |
} |
| 17 |
|
| 18 |
type PathLocalizeError struct { |
| 19 |
Path string |
| 20 |
FileError error |
| 21 |
RootError error |
| 22 |
} |
| 23 |
|
| 24 |
func (ple PathLocalizeError) Error() string { |
| 25 |
return fmt.Sprintf(`could not localize path %q as file: %s; could not localize path %q as directory: %s`, |
| 26 |
ple.Path, ple.FileError, ple.Path, ple.RootError) |
| 27 |
} |