Skip to content

Commit

Permalink
log tracebacks for tasks and log errors
Browse files Browse the repository at this point in the history
  • Loading branch information
acrantel committed Jan 22, 2024
1 parent ba4f7c5 commit 5050f8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions saturn/pkg/saturn/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"runtime/debug"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -92,10 +93,10 @@ func (t *Task) Run(ctx context.Context, r Reporter) (err error) {
panic(r)
}
if err != nil {
// TODO: log a traceback
log.Ctx(ctx).Error().Msg(string(debug.Stack()))
}
if err = t.FinalizeReport(ctx, r); err != nil {
err = fmt.Errorf("t.FinalizeReport: %v", err)
if errReport = t.FinalizeReport(ctx, r); errReport != nil {
err = fmt.Errorf("%v, t.FinalizeReport: %v", err, errReport)
}
if t.status.Retryable() {
err = fmt.Errorf("task not complete: %v", err)
Expand Down

0 comments on commit 5050f8c

Please sign in to comment.