Generated friendly error message for some exception types
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
import socket
|
||||||
import traceback
|
import traceback
|
||||||
import uuid
|
import uuid
|
||||||
import weakref
|
import weakref
|
||||||
@@ -186,7 +187,12 @@ class IndexHandler(tornado.web.RequestHandler):
|
|||||||
args = self.get_args()
|
args = self.get_args()
|
||||||
dst_addr = '{}:{}'.format(*args[:2])
|
dst_addr = '{}:{}'.format(*args[:2])
|
||||||
logging.info('Connecting to {}'.format(dst_addr))
|
logging.info('Connecting to {}'.format(dst_addr))
|
||||||
ssh.connect(*args)
|
try:
|
||||||
|
ssh.connect(*args, timeout=6)
|
||||||
|
except socket.error:
|
||||||
|
raise ValueError('Unable to connect to {}'.format(dst_addr))
|
||||||
|
except paramiko.BadAuthenticationType:
|
||||||
|
raise ValueError('Authentication failed.')
|
||||||
chan = ssh.invoke_shell(term='xterm')
|
chan = ssh.invoke_shell(term='xterm')
|
||||||
chan.setblocking(0)
|
chan.setblocking(0)
|
||||||
worker = Worker(ssh, chan, dst_addr)
|
worker = Worker(ssh, chan, dst_addr)
|
||||||
|
|||||||
Reference in New Issue
Block a user