change: print panic trace

This commit is contained in:
debugtalk
2022-03-25 16:19:20 +08:00
parent ceb31b1982
commit a4e28601e9

View File

@@ -1,11 +1,9 @@
package main package main
import ( import (
"os"
"time" "time"
"github.com/getsentry/sentry-go" "github.com/getsentry/sentry-go"
"github.com/rs/zerolog/log"
"github.com/httprunner/httprunner/hrp/cmd" "github.com/httprunner/httprunner/hrp/cmd"
) )
@@ -16,9 +14,11 @@ func main() {
// report panic to sentry // report panic to sentry
sentry.CurrentHub().Recover(err) sentry.CurrentHub().Recover(err)
sentry.Flush(time.Second * 5) sentry.Flush(time.Second * 5)
log.Error().Interface("err", err).Msg("recover panic")
os.Exit(1) // print panic trace
panic(err)
} }
}() }()
cmd.Execute() cmd.Execute()
} }