From bdcec99e2971c23095ef991b81a3cf81a5d8832c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 20 Oct 2014 11:32:04 -0400 Subject: display stack traces with exceptions --- termcast_server/__init__.py | 3 +++ termcast_server/ssh.py | 2 ++ termcast_server/termcast.py | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/termcast_server/__init__.py b/termcast_server/__init__.py index ca6adc0..de2af21 100644 --- a/termcast_server/__init__.py +++ b/termcast_server/__init__.py @@ -2,6 +2,7 @@ import signal import socket import sys import threading +import traceback import uuid from . import pubsub @@ -69,6 +70,7 @@ class Server(object): sock.listen(100) client, addr = sock.accept() except Exception as e: + print(traceback.format_exc()) print('*** Listen/accept failed: ' + str(e)) continue @@ -81,6 +83,7 @@ class Server(object): try: connection.run() except Exception as e: + print(traceback.format_exc()) print('Running connection failed: ' + str(e)) self.publisher.unsubscribe(connection) client.close() diff --git a/termcast_server/ssh.py b/termcast_server/ssh.py index fe585df..0b03f28 100644 --- a/termcast_server/ssh.py +++ b/termcast_server/ssh.py @@ -3,6 +3,7 @@ import paramiko import select import threading import time +import traceback class Connection(object): def __init__(self, client, connection_id, publisher, keyfile): @@ -128,6 +129,7 @@ class Connection(object): try: total_sent += self.chan.send(data[total_sent:]) except Exception as e: + print(traceback.format_exc()) print("*** send failed: " + str(e)) break diff --git a/termcast_server/termcast.py b/termcast_server/termcast.py index 8a4e98a..97bcc6b 100644 --- a/termcast_server/termcast.py +++ b/termcast_server/termcast.py @@ -1,7 +1,8 @@ -import time import json import re import ssl +import time +import traceback import vt100 @@ -213,6 +214,7 @@ class Connection(object): try: buf = self.client.recv(1024) except Exception as e: + print(traceback.format_exc()) print('*** recv failed: ' + str(e)) if len(buf) > 0: @@ -290,6 +292,7 @@ class Connection(object): self.client, server_side=True ) except Exception as e: + print(traceback.format_exc()) print('*** TLS connection failed: ' + str(e)) return False -- cgit v1.2.3