mirror of https://github.com/huashengdun/webssh
				
				
				
			Generated friendly error message for some exception types
							parent
							
								
									c9913a4108
								
							
						
					
					
						commit
						02c56e7a34
					
				
							
								
								
									
										8
									
								
								main.py
								
								
								
								
							
							
						
						
									
										8
									
								
								main.py
								
								
								
								
							|  | @ -1,6 +1,7 @@ | |||
| import io | ||||
| import logging | ||||
| import os.path | ||||
| import socket | ||||
| import traceback | ||||
| import uuid | ||||
| import weakref | ||||
|  | @ -186,7 +187,12 @@ class IndexHandler(tornado.web.RequestHandler): | |||
|         args = self.get_args() | ||||
|         dst_addr = '{}:{}'.format(*args[:2]) | ||||
|         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.setblocking(0) | ||||
|         worker = Worker(ssh, chan, dst_addr) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Sheng
						Sheng