diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-11 01:39:33 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-11 01:39:33 +0200 |
commit | ffdf143be42490f05cb2b69cdb83e74264d6070a (patch) | |
tree | c862055d2a73aeb3689ffbb9770b980d9b4cbff5 /libmproxy/proxy/server.py | |
parent | c159c8ca13afa6a909f456e41c1a3f57b98baf8a (diff) | |
download | mitmproxy-ffdf143be42490f05cb2b69cdb83e74264d6070a.tar.gz mitmproxy-ffdf143be42490f05cb2b69cdb83e74264d6070a.tar.bz2 mitmproxy-ffdf143be42490f05cb2b69cdb83e74264d6070a.zip |
better exception handling
Diffstat (limited to 'libmproxy/proxy/server.py')
-rw-r--r-- | libmproxy/proxy/server.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libmproxy/proxy/server.py b/libmproxy/proxy/server.py index 91a12df9..c00bb815 100644 --- a/libmproxy/proxy/server.py +++ b/libmproxy/proxy/server.py @@ -3,6 +3,7 @@ from __future__ import (absolute_import, print_function, division) import traceback import sys import socket +import six from netlib import tcp from netlib.http.http1 import HTTP1Protocol @@ -39,7 +40,11 @@ class ProxyServer(tcp.TCPServer): try: super(ProxyServer, self).__init__((config.host, config.port)) except socket.error as e: - raise ServerException('Error starting proxy server: ' + repr(e), e) + six.reraise( + ServerException, + ServerException('Error starting proxy server: ' + repr(e), e), + sys.exc_info()[2] + ) self.channel = None def start_slave(self, klass, channel): @@ -117,6 +122,7 @@ class ConnectionHandler(object): self.log("Connection killed", "info") except ProtocolException as e: self.log(repr(e), "info") + self.log(traceback.format_exc(), "debug") # If an error propagates to the topmost level, # we send an HTTP error response, which is both # understandable by HTTP clients and humans. |