Add panic handler to sendrpcmessage to catch channel errors (#1938)

This commit is contained in:
Evan Simkowitz 2025-02-10 15:54:14 -08:00 committed by GitHub
parent 2b060ebc98
commit b4aeb80ae3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,7 @@ import (
"sync"
"github.com/google/uuid"
"github.com/wavetermdev/waveterm/pkg/panichandler"
"github.com/wavetermdev/waveterm/pkg/util/shellutil"
"github.com/wavetermdev/waveterm/pkg/util/utilfn"
"github.com/wavetermdev/waveterm/pkg/wshrpc"
@ -247,7 +248,11 @@ func (p *WshRpcProxy) HandleAuthentication() (*wshrpc.RpcContext, error) {
}
}
// TODO: Figure out who is sending to closed routes and why we're not catching it
func (p *WshRpcProxy) SendRpcMessage(msg []byte) {
defer func() {
panichandler.PanicHandler("WshRpcProxy.SendRpcMessage", recover())
}()
p.ToRemoteCh <- msg
}