mirror of
https://github.com/golang/go
synced 2024-11-18 03:44:46 -07:00
internal/lsp/lsprpc: make the LSP forwarder exit error clearer
In cases where the remote panics, make it clearer in the forwarder logs that the remote has disconnected. Change-Id: Ic7f9370f615198274696a18adaefe7dc62cac02e Reviewed-on: https://go-review.googlesource.com/c/tools/+/250508 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
6fbec87eed
commit
80e1b0398e
@ -251,10 +251,13 @@ func (f *Forwarder) ServeStream(ctx context.Context, clientConn jsonrpc2.Conn) e
|
||||
serverConn.Close()
|
||||
}
|
||||
|
||||
err = serverConn.Err()
|
||||
if err == nil {
|
||||
err = clientConn.Err()
|
||||
err = nil
|
||||
if serverConn.Err() != nil {
|
||||
err = errors.Errorf("remote disconnected: %v", err)
|
||||
} else if clientConn.Err() != nil {
|
||||
err = errors.Errorf("client disconnected: %v", err)
|
||||
}
|
||||
event.Log(ctx, fmt.Sprintf("forwarder: exited with error: %v", err))
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user