-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
cli: enhance errors reported upon conn failures #28200
Conversation
I'm taking suggestions as to how to best test this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm taking suggestions as to how to best test this.
I would look at adapting the infrastructure in cli/cli_test.go
. But rather than using cliTest.RunWithArgs
, you call cli.Run
directly for various commands and flag settings which exercise your new error messages.
Reviewable status: complete! 0 of 0 LGTMs obtained
ok thanks will look into it |
fec24a7
to
6d2a8d3
Compare
Now with tests. RFAL. |
6d2a8d3
to
27154cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/cli/error.go, line 87 at r1 (raw file):
connFailed := func() error { const format = "cannot dial server.\n" + "Is the server started already?\n" +
s/started already/running/
Prior to this patch, the various CLI commands were making a halfhearted attempt at decorating the underlying error with some troubleshooting instructions. Unfortunately, this was mixing up situations where the TCP connection failed outright, those where the security settings were incorrect, and connections dropped later, after the initial handshake was successful. In practice, we've noticed that the troubleshooting steps are rather different for both kinds of situations. So this patch enhances the code to clarify what is going on. It attempts to distinguish: - TCP connection problem ("check --host vs --advertise-host"). - secure conn to insecure server ("use --insecure?") - invalid TLS settings / TLS auth error ("check credentials"). - timeouts. - connection lost (e.g. conn closed by server). Release note (cli change): The various `cockroach` client comments now better attempt to inform the user about why a connection is failing.
27154cc
to
0894cd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/cli/error.go, line 87 at r1 (raw file):
Previously, bdarnell (Ben Darnell) wrote…
s/started already/running/
Done.
thanks! bors r+ cc @jseldess |
28200: cli: enhance errors reported upon conn failures r=knz a=knz Fixes #24788. Prior to this patch, the various CLI commands were making a halfhearted attempt at decorating the underlying error with some troubleshooting instructions. Unfortunately, this was mixing up situations where the TCP connection failed outright, those where the security settings were incorrect, and connections dropped later, after the initial handshake was successful. In practice, we've noticed that the troubleshooting steps are rather different for both kinds of situations. So this patch enhances the code to clarify what is going on. It attempts to distinguish: - TCP connection problem ("check --host vs --advertise-host"). - secure conn to insecure server ("use --insecure?") - invalid TLS settings / TLS auth error ("check credentials"). - timeouts. - connection lost (e.g. conn closed by server). Release note (cli change): The various `cockroach` client comments now better attempt to inform the user about why a connection is failing. Co-authored-by: Raphael 'kena' Poss <[email protected]>
Build succeeded |
Fixes #24788.
Prior to this patch, the various CLI commands were making
a halfhearted attempt at decorating the underlying error with some
troubleshooting instructions.
Unfortunately, this was mixing up situations where the TCP connection
failed outright, those where the security settings were incorrect, and
connections dropped later, after the initial handshake was
successful.
In practice, we've noticed that the troubleshooting steps are rather
different for both kinds of situations. So this patch enhances the
code to clarify what is going on. It attempts to distinguish:
Release note (cli change): The various
cockroach
client commentsnow better attempt to inform the user about why a connection is failing.