From 6130e48a6705971af96534c719c073b5c43cc0bc Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 26 Oct 2017 05:15:55 -0400 Subject: [PATCH] always log the panic trace --- irc/client.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/irc/client.go b/irc/client.go index 528e1e19..9fc9d929 100644 --- a/irc/client.go +++ b/irc/client.go @@ -185,10 +185,13 @@ func (client *Client) run() { var msg ircmsg.IrcMessage defer func() { - if client.server.RecoverFromErrors() { - if r := recover(); r != nil { - client.server.logger.Error("internal", - fmt.Sprintf("Client caused panic, disconnecting: %v\n%s", r, debug.Stack())) + if r := recover(); r != nil { + client.server.logger.Error("internal", + fmt.Sprintf("Client caused panic: %v\n%s", r, debug.Stack())) + if client.server.RecoverFromErrors() { + client.server.logger.Error("internal", "Disconnecting client and attempting to recover") + } else { + panic(r) } } // ensure client connection gets closed