Skip to content

Commit 7350b10

Browse files
committed
Improve error message in case of paramiko failure
Fix issues where essential error about paramiko dealing code was lost due to ageneric exception that assumed paramiko library was missing. To keep backwards compatibility we keep the custom exception but we also include information from original exception that caused it. It was wrong to believe that only missing paramiko can cause it, even code inside docker-py can thow exceptions, and NamedException is very broad exception class.
1 parent 61bab63 commit 7350b10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docker/api/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ def __init__(self, base_url=None, version=None,
161161
self._custom_adapter = SSHAdapter(
162162
base_url, timeout, pool_connections=num_pools
163163
)
164-
except NameError:
164+
except NameError as e:
165+
# do not hide orrinal exception as it may contain variou
165166
raise DockerException(
166-
'Install paramiko package to enable ssh:// support'
167+
"Paramiko failure while trying ssh:// protocol:\n%s" % e
167168
)
168169
self.mount('http+docker://ssh', self._custom_adapter)
169170
self._unmount('http://', 'https://')

0 commit comments

Comments
 (0)