From 4768833a166f6fa757c3a3e001bb357b15d00914 Mon Sep 17 00:00:00 2001 From: Andrey Romancev Date: Wed, 28 Aug 2019 17:19:16 +0300 Subject: [PATCH] Print stacktrace on panic recover. (#117) --- message/router.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/message/router.go b/message/router.go index cf734a56f..6c2c36861 100644 --- a/message/router.go +++ b/message/router.go @@ -3,6 +3,7 @@ package message import ( "context" "fmt" + "runtime/debug" "sync" "time" @@ -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 }