Skip to content

Commit 24fafdc

Browse files
committed
Print panic stack traces (#921)
(cherry picked from commit d02ab00)
1 parent 7cf4494 commit 24fafdc

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

pkg/lib/cron/cron.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func (c *Cron) Cancel() {
7171

7272
func recoverer(errHandler func(error)) {
7373
if errInterface := recover(); errInterface != nil {
74-
errHandler(errors.CastRecoverError(errInterface))
74+
err := errors.CastRecoverError(errInterface)
75+
errors.PrintStacktrace(err)
76+
errHandler(err)
7577
}
7678
}

pkg/lib/exit/exit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func Panic(err error, wrapStrs ...string) {
6363
func RecoverAndExit(strs ...string) {
6464
if errInterface := recover(); errInterface != nil {
6565
err := errors.CastRecoverError(errInterface, strs...)
66-
errors.PrintErrorForUser(err)
67-
os.Exit(1)
66+
Panic(err)
6867
}
6968
}

pkg/operator/endpoints/respond.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func respondErrorCode(w http.ResponseWriter, r *http.Request, code int, err erro
6363
func recoverAndRespond(w http.ResponseWriter, r *http.Request, strs ...string) {
6464
if errInterface := recover(); errInterface != nil {
6565
err := errors.CastRecoverError(errInterface, strs...)
66+
errors.PrintStacktrace(err)
6667
telemetry.Error(err)
6768
respondError(w, r, err)
6869
}

0 commit comments

Comments
 (0)