We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18c5f78 commit f336f5cCopy full SHA for f336f5c
engine/worker/cmd_run.go
@@ -2,10 +2,13 @@ package main
2
3
import (
4
"context"
5
+ "fmt"
6
"os"
7
"os/signal"
8
"syscall"
9
+ "time"
10
11
+ "github.com/sirupsen/logrus"
12
"github.com/spf13/cobra"
13
14
"github.com/ovh/cds/engine/worker/internal"
@@ -62,6 +65,13 @@ func runCmd() func(cmd *cobra.Command, args []string) {
62
65
}()
63
66
// Start the worker
64
67
if err := internal.StartWorker(ctx, w, bookedWJobID); err != nil {
68
+ isErrWithStack := sdk.IsErrorWithStack(err)
69
+ fields := logrus.Fields{}
70
+ if isErrWithStack {
71
+ fields["stack_trace"] = fmt.Sprintf("%+v", err)
72
+ }
73
+ log.ErrorWithFields(ctx, fields, "%v", err)
74
+ time.Sleep(2 * time.Second)
75
sdk.Exit("error: %v", err)
76
}
77
0 commit comments