You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When checking for a particular case where the SSH session should be closed and restablished, I am using a workaround: err.Error() == "ssh: disconnect, reason 11:"
What did you see happen?
String-comparing the error message works but is brittle and non-optimal.
What did you expect to see?
We would expect type disconnectMsg to be exported (ie DisconnectMsg) to allow comparison via: sErr ssh.DisconnectMsg if errors.As(err, &sErr) && sErr.Reason == 11) { ...
or just: if errors.Is(err, ssh.DisconnectMsg) { ...
Similar error types, for example ExitError are exported for this rationale.
I can prepare a non-breaking (API compatible) Pull Request to address this issue if there are no objections?
The text was updated successfully, but these errors were encountered:
seankhliao
changed the title
crypto/ssh: non-exported disconnectMsg prevents checking code
proposal: x/crypto/ssh: export disconnectMsg error type
Jan 20, 2024
Go version
1.12.1
Output of
go env
in your module/workspace:What did you do?
When checking for a particular case where the SSH session should be closed and restablished, I am using a workaround:
err.Error() == "ssh: disconnect, reason 11:"
What did you see happen?
String-comparing the error message works but is brittle and non-optimal.
What did you expect to see?
We would expect
type disconnectMsg
to be exported (ieDisconnectMsg
) to allow comparison via:sErr ssh.DisconnectMsg if errors.As(err, &sErr) && sErr.Reason == 11) { ...
or just:
if errors.Is(err, ssh.DisconnectMsg) { ...
Similar error types, for example
ExitError
are exported for this rationale.I can prepare a non-breaking (API compatible) Pull Request to address this issue if there are no objections?
The text was updated successfully, but these errors were encountered: