forked from External/ergo
always log the panic trace
This commit is contained in:
parent
7b58bf76ef
commit
6130e48a67
1 changed files with 7 additions and 4 deletions
|
|
@ -185,10 +185,13 @@ func (client *Client) run() {
|
||||||
var msg ircmsg.IrcMessage
|
var msg ircmsg.IrcMessage
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if client.server.RecoverFromErrors() {
|
if r := recover(); r != nil {
|
||||||
if r := recover(); r != nil {
|
client.server.logger.Error("internal",
|
||||||
client.server.logger.Error("internal",
|
fmt.Sprintf("Client caused panic: %v\n%s", r, debug.Stack()))
|
||||||
fmt.Sprintf("Client caused panic, disconnecting: %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
|
// ensure client connection gets closed
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue