From 531229628359abce569cd68cda11cb1248ae45d6 Mon Sep 17 00:00:00 2001 From: David Wahler Date: Mon, 25 Jul 2022 10:25:34 -0500 Subject: [PATCH] fix: Add a slightly better error message for dropped SSH connection (#3131) --- cli/ssh.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli/ssh.go b/cli/ssh.go index 81eacc33f0..d3d2b36c53 100644 --- a/cli/ssh.go +++ b/cli/ssh.go @@ -2,6 +2,7 @@ package cli import ( "context" + "errors" "fmt" "io" "os" @@ -231,6 +232,11 @@ func ssh() *cobra.Command { err = sshSession.Wait() if err != nil { + // If the connection drops unexpectedly, we get an ExitMissingError but no other + // error details, so try to at least give the user a better message + if errors.Is(err, &gossh.ExitMissingError{}) { + return xerrors.New("SSH connection ended unexpectedly") + } return err }