Closed vaintrub closed 1 year ago
Hi @vaintrub I am not sure why you can't implement this yourself. Can't you start your Handler with
defer func() {
if r := recover(); r != nil {
// do something reasonable on panic
}
}()
I tried to do this, but I still couldn’t catch the panic. I solved the problem, thanks. It turned out that I had a goroutine leak 😅
Hi! Thank you very much for your library and the work on it!
We encountered a problem that the entire application crashes if a panic occurs in our handlers, but as it turns out, you create a separate goroutine that reads messages, which is why we are unable to recover the panic ourselves.
https://github.com/sourcegraph/jsonrpc2/blob/8a0bf06edfb027f0c070c1f6e6515aaf295a051f/conn.go#L62
it would be very cool if it were possible to add
jsonrpc2.HandlerWithPanicRecover