From 573bd283cde2f8610905e09b7b72f810b87567d8 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Fri, 6 Jun 2025 00:32:40 -0400 Subject: [PATCH] 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. --- lang/funcs/dage/dage.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/funcs/dage/dage.go b/lang/funcs/dage/dage.go index 97c2ee90..e6e89189 100644 --- a/lang/funcs/dage/dage.go +++ b/lang/funcs/dage/dage.go @@ -1259,7 +1259,15 @@ func (obj *Engine) Run(ctx context.Context) (reterr error) { obj.statsMutex.Unlock() } 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 // the first to error will cause ag to // shutdown, so make sure we can exit...