From 74231a04186c3ab71f1a8932afd485b51717acf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Eriksson?= <andre@encore.dev> Date: Tue, 15 Oct 2024 15:29:15 +0100 Subject: [PATCH] cli/daemon/run: avoid double-reporting parse errors (#1482) This wasn't a big problem for Go errors as we only reported the first line, but it was problematic for TypeScript errors which duplicated the full error output. --- cli/daemon/run/exec_script.go | 3 ++- cli/daemon/run/run.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/daemon/run/exec_script.go b/cli/daemon/run/exec_script.go index c2373f6758..cf945a9849 100644 --- a/cli/daemon/run/exec_script.go +++ b/cli/daemon/run/exec_script.go @@ -99,7 +99,8 @@ func (mgr *Manager) ExecScript(ctx context.Context, p ExecScriptParams) (err err ParseTests: false, }) if err != nil { - tracker.Fail(parseOp, err) + // Don't use the error itself in tracker.Fail, as it will lead to duplicate error output. + tracker.Fail(parseOp, errors.New("parse error")) return err } if err := p.App.CacheMetadata(parse.Meta); err != nil { diff --git a/cli/daemon/run/run.go b/cli/daemon/run/run.go index 915343f0b7..3e8fa475da 100644 --- a/cli/daemon/run/run.go +++ b/cli/daemon/run/run.go @@ -369,9 +369,11 @@ func (r *Run) buildAndStart(ctx context.Context, tracker *optracker.OpTracker, i ParseTests: false, }) if err != nil { - tracker.Fail(parseOp, err) + // Don't use the error itself in tracker.Fail, as it will lead to duplicate error output. + tracker.Fail(parseOp, errors.New("parse error")) return err } + if err := r.App.CacheMetadata(parse.Meta); err != nil { return errors.Wrap(err, "cache metadata") }