Skip to content

Commit

Permalink
Print stacktrace on panic recover. (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Romancev authored and m110 committed Aug 28, 2019
1 parent b8fcecb commit 4768833
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion message/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package message
import (
"context"
"fmt"
"runtime/debug"
"sync"
"time"

Expand Down Expand Up @@ -498,7 +499,11 @@ func (h *handler) handleMessage(msg *Message, handler HandlerFunc) {

defer func() {
if recovered := recover(); recovered != nil {
h.logger.Error("Panic recovered in handler", errors.Errorf("%s", recovered), nil)
h.logger.Error(
"Panic recovered in handler. Stack: " + string(debug.Stack()),
errors.Errorf("%s", recovered),
nil,
)
msg.Nack()
return
}
Expand Down

0 comments on commit 4768833

Please # to comment.