aboutsummaryrefslogtreecommitdiff
path: root/ssh
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2023-08-28 23:22:54 +0700
committerShulhan <m.shulhan@gmail.com>2023-08-28 23:27:12 +0700
commite417676254617e1e2e7bc68700bbade116295b62 (patch)
tree5e3a4eba4eaa9b4f801c0121038a6e75a572127d /ssh
parentb4ddeeda5bc71549846db71ba23e83ecb26f36ed (diff)
downloadgo-x-crypto-client-wrap-error.mailed.tar.xz
crypto/ssh: return error from NewClientConn with "%w"client-wrap-error.mailed
By returning error with %w, the caller can check and convert the error using errors.As, for example to knownhosts.KeyError. Change-Id: I0529e2e935cd8075f87aa6f6049cee3323f82c06
Diffstat (limited to 'ssh')
-rw-r--r--ssh/client.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssh/client.go b/ssh/client.go
index bdc356c..fd8c497 100644
--- a/ssh/client.go
+++ b/ssh/client.go
@@ -82,7 +82,7 @@ func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan
if err := conn.clientHandshake(addr, &fullConf); err != nil {
c.Close()
- return nil, nil, nil, fmt.Errorf("ssh: handshake failed: %v", err)
+ return nil, nil, nil, fmt.Errorf("ssh: handshake failed: %w", err)
}
conn.mux = newMux(conn.transport)
return conn, conn.mux.incomingChannels, conn.mux.incomingRequests, nil