Skip to content

Commit

Permalink
Crashing error messages now will print stacktrace. (#2277)
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka committed Mar 17, 2020
1 parent cc0b7e6 commit 70c318a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/thanos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ func main() {
reloadCh := make(chan struct{}, 1)

if err := cmds[cmd](&g, logger, metrics, tracer, reloadCh, *logLevel == "debug"); err != nil {
level.Error(logger).Log("err", errors.Wrapf(err, "%s command failed", cmd))
// Use %+v for github.com/pkg/errors error to print with stack.
level.Error(logger).Log("err", fmt.Sprintf("%+v", errors.Wrapf(err, "preparing %s command failed", cmd)))
os.Exit(1)
}

Expand All @@ -207,7 +208,8 @@ func main() {
}

if err := g.Run(); err != nil {
level.Error(logger).Log("msg", "running command failed", "err", err)
// Use %+v for github.com/pkg/errors error to print with stack.
level.Error(logger).Log("err", fmt.Sprintf("%+v", errors.Wrapf(err, "%s command failed", cmd)))
os.Exit(1)
}
level.Info(logger).Log("msg", "exiting")
Expand Down

0 comments on commit 70c318a

Please sign in to comment.