添加异常处理

pull/6/head
ibuler 2014-12-30 23:51:00 +08:00
parent 0b97c19862
commit 894911126b
1 changed files with 1 additions and 1 deletions

View File

@ -323,7 +323,7 @@ def connect(username, password, host, port, login_name, login_type='L'):
ssh.connect(host, port=port, username=username, password=password, key_filename=key_filename, compress=True) ssh.connect(host, port=port, username=username, password=password, key_filename=key_filename, compress=True)
else: else:
ssh.connect(host, port=port, username=username, password=password, compress=True) ssh.connect(host, port=port, username=username, password=password, compress=True)
except paramiko.ssh_exception.AuthenticationException: except paramiko.ssh_exception.AuthenticationException, paramiko.ssh_exception.SSHException:
raise ServerError('Authentication Error.') raise ServerError('Authentication Error.')
except socket.error: except socket.error:
raise ServerError('Connect SSH Socket Port Error, Please Correct it.') raise ServerError('Connect SSH Socket Port Error, Please Correct it.')