3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 03:49:27 +01:00

always log the panic trace

This commit is contained in:
Shivaram Lingamneni 2017-10-26 05:15:55 -04:00
parent 7b58bf76ef
commit 6130e48a67

View File

@ -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