MCPcopy Index your code
hub / github.com/helm/helm / parseTemplateExecErrorString

Function parseTemplateExecErrorString

pkg/engine/engine.go:354–384  ·  view source on GitHub ↗

parseTemplateExecErrorString parses a template execution error string from text/template without using regular expressions. It returns a TraceableError and true if parsing succeeded.

(s string)

Source from the content-addressed store, hash-verified

352// parseTemplateExecErrorString parses a template execution error string from text/template
353// without using regular expressions. It returns a TraceableError and true if parsing succeeded.
354func parseTemplateExecErrorString(s string) (TraceableError, bool) {
355 const prefix = "template: "
356 if !strings.HasPrefix(s, prefix) {
357 return TraceableError{}, false
358 }
359 remainder := s[len(prefix):]
360
361 // Special case: "template: no template %q associated with template %q"
362 // Matches https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=191
363 traceableError, done := parseTemplateNoTemplateError(s, remainder)
364 if done {
365 return traceableError, true
366 }
367
368 // Executing form: "<templateName>: executing \"<funcName>\" at <<location>>: <errMsg>[ template:...]"
369 // Matches https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=141
370 traceableError, done = parseTemplateExecutingAtErrorType(remainder)
371 if done {
372 return traceableError, true
373 }
374
375 // Simple form: "<templateName>: <errMsg>"
376 // Use LastIndex to avoid splitting colons within line:col info.
377 // Matches https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=138
378 traceableError, done = parseTemplateSimpleErrorString(remainder)
379 if done {
380 return traceableError, true
381 }
382
383 return TraceableError{}, false
384}
385
386// Special case: "template: no template %q associated with template %q"
387// Matches https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=191

Callers 1

reformatExecErrorMsgFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…