lang: funcs: dage: Print out some error locations

Most things don't support this yet, but let's get in some initial
plumbing. It's always difficult to know which function failed, so we
need to start telling the users more precisely.
This commit is contained in:
James Shubin
2025-06-06 00:32:40 -04:00
parent 6ac72974eb
commit 573bd283cd

View File

@@ -1259,7 +1259,15 @@ func (obj *Engine) Run(ctx context.Context) (reterr error) {
obj.statsMutex.Unlock() obj.statsMutex.Unlock()
} }
if runErr != nil { if runErr != nil {
obj.Logf("Erroring func `%s`: %+v", node, runErr) err := fmt.Errorf("func `%s` errored: %+v", node, runErr)
displayer, ok := node.Func.(interfaces.TextDisplayer)
if ok {
if highlight := displayer.HighlightText(); highlight != "" {
obj.Logf("%s: %s", err.Error(), highlight)
}
}
obj.Logf("%s", err.Error())
// send to a aggregate channel // send to a aggregate channel
// the first to error will cause ag to // the first to error will cause ag to
// shutdown, so make sure we can exit... // shutdown, so make sure we can exit...