Executing form: " : executing \" \" at < >: [ template:...]" Matches https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=141
(remainder string)
| 410 | // Executing form: "<templateName>: executing \"<funcName>\" at <<location>>: <errMsg>[ template:...]" |
| 411 | // Matches https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=141 |
| 412 | func parseTemplateExecutingAtErrorType(remainder string) (TraceableError, bool) { |
| 413 | if templateName, after, found := strings.Cut(remainder, ": executing "); found { |
| 414 | if len(after) == 0 || after[0] != '"' { |
| 415 | return TraceableError{}, false |
| 416 | } |
| 417 | // find closing quote for function name |
| 418 | endQuote := strings.IndexByte(after[1:], '"') |
| 419 | if endQuote == -1 { |
| 420 | return TraceableError{}, false |
| 421 | } |
| 422 | endQuote++ // account for offset we started at 1 |
| 423 | functionName := after[1:endQuote] |
| 424 | afterFunc := after[endQuote+1:] |
| 425 | |
| 426 | // expect: " at <" then location then ">: " then message |
| 427 | const atPrefix = " at <" |
| 428 | if !strings.HasPrefix(afterFunc, atPrefix) { |
| 429 | return TraceableError{}, false |
| 430 | } |
| 431 | afterAt := afterFunc[len(atPrefix):] |
| 432 | locationName, errMsg, found := strings.Cut(afterAt, ">: ") |
| 433 | if !found { |
| 434 | return TraceableError{}, false |
| 435 | } |
| 436 | |
| 437 | // trim chained next error starting with space + "template:" if present |
| 438 | if cut := strings.Index(errMsg, " template:"); cut != -1 { |
| 439 | errMsg = errMsg[:cut] |
| 440 | } |
| 441 | return TraceableError{ |
| 442 | location: templateName, |
| 443 | message: errMsg, |
| 444 | executedFunction: "executing \"" + functionName + "\" at <" + locationName + ">:", |
| 445 | }, true |
| 446 | } |
| 447 | return TraceableError{}, false |
| 448 | } |
| 449 | |
| 450 | // reformatExecErrorMsg takes an error message for template rendering and formats it into a formatted |
| 451 | // multi-line error string |
searching dependent graphs…