Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Add a slightly better error message for dropped SSH connection #3131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2022

Conversation

dwahler
Copy link
Contributor

@dwahler dwahler commented Jul 22, 2022

If an SSH connection drops, we typically get an ssh.ExitMissingError from the client, which doesn't have a very user-friendly error message:

wait: remote command exited without exit status or exit signal

This PR looks for that error type and replaces it with message that, while not necessarily more helpful, at least doesn't incorrectly state the problem is on the remote side:

SSH connection ended unexpectedly

Partial fix for #1369

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

nit: typically we conform to fix: or feat: prefixes, but we should enforce this with a CI check so none slip

cli/ssh.go Outdated
@@ -35,6 +36,8 @@ import (
var workspacePollInterval = time.Minute
var autostopNotifyCountdown = []time.Duration{30 * time.Minute}

var errConnectionDropped = xerrors.New("SSH connection ended unexpectedly")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could inline this for now until it needs to be used elsewhere!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another point for inlining: it produces a stacktrace, otherwise we have to wrap the error to get a stack trace.

@dwahler dwahler changed the title Add a slightly better error message for dropped SSH connection fix: Add a slightly better error message for dropped SSH connection Jul 22, 2022
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dwahler dwahler merged commit 5312296 into main Jul 25, 2022
@dwahler dwahler deleted the dwahler/1369-ssh-drop-error branch July 25, 2022 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants