perf: 优化测试网域可连接性的错误提示信息

This commit is contained in:
Bai
2021-07-26 15:50:09 +08:00
committed by Jiangjie.Bai
parent 51387ad97e
commit 21b789e08c
3 changed files with 43 additions and 28 deletions

View File

@@ -79,7 +79,13 @@ class Gateway(BaseUser):
paramiko.SSHException,
paramiko.ssh_exception.NoValidConnectionsError,
socket.gaierror) as e:
return False, str(e)
err = str(e)
if err.startswith('[Errno None] Unable to connect to port'):
err = _('Unable to connect to port {port} on {ip}')
err = err.format(port=self.port, ip=self.ip)
elif err == 'Authentication failed.':
err = _('Authentication failed')
return False, err
try:
sock = proxy.get_transport().open_channel(