wrapLookupError enriches a raw `lookup` error with two layers of operator-facing context: 1. The wrap message names the resource kind, namespace, id, and dialed endpoints — the pre-fix chain stripped these and forced the operator to read the chart template trace to recover them. 2. An errors.WithHi
(err error, kind, namespace, docID string, endpoints []string, commandName string)
| 152 | // Returns nil when err is nil so call sites can use it |
| 153 | // unconditionally after `helpers.ForEachResource`. |
| 154 | func wrapLookupError(err error, kind, namespace, docID string, endpoints []string, commandName string) error { |
| 155 | if err == nil { |
| 156 | return nil |
| 157 | } |
| 158 | |
| 159 | enriched := errors.Wrapf(err, |
| 160 | "looking up resource kind=%q namespace=%q id=%q on endpoints=%v", |
| 161 | kind, namespace, docID, endpoints) |
| 162 | |
| 163 | class := classifyLookupError(err) |
| 164 | |
| 165 | //nolint:wrapcheck // WithHint annotates the already-wrapped error chain; double-wrap would obscure the chain. |
| 166 | return errors.WithHint(enriched, hintForClass(class, commandName, kind, endpoints)) |
| 167 | } |
| 168 | |
| 169 | // hintForClass returns the human-facing remedy for a classified |
| 170 | // lookup failure. The `talm apply` branch never mentions `--offline` |