| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package charttpl |
| 4 | |
| 5 | import ( |
| 6 | "errors" |
| 7 | "fmt" |
| 8 | ) |
| 9 | |
| 10 | var ( |
| 11 | errDecode = errors.New("charttpl: decode failed") |
| 12 | errSemanticCheck = errors.New("charttpl: semantic validation failed") |
| 13 | ) |
| 14 | |
| 15 | // fieldError pins validation failure to one logical field path. |
| 16 | type fieldError struct { |
| 17 | Path string |
| 18 | Reason string |
| 19 | } |
| 20 | |
| 21 | func (e fieldError) Error() string { |
| 22 | if e.Path == "" { |
| 23 | return e.Reason |
| 24 | } |
| 25 | return fmt.Sprintf("%s: %s", e.Path, e.Reason) |
| 26 | } |