Skip to content

Commit

Permalink
cli/daemon/run: avoid double-reporting parse errors (#1482)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eandre authored Oct 15, 2024
1 parent d61400d commit 74231a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cli/daemon/run/exec_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion cli/daemon/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 74231a0

Please sign in to comment.