aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/rawtcp.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-11 01:39:33 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-11 01:39:33 +0200
commitffdf143be42490f05cb2b69cdb83e74264d6070a (patch)
treec862055d2a73aeb3689ffbb9770b980d9b4cbff5 /libmproxy/protocol/rawtcp.py
parentc159c8ca13afa6a909f456e41c1a3f57b98baf8a (diff)
downloadmitmproxy-ffdf143be42490f05cb2b69cdb83e74264d6070a.tar.gz
mitmproxy-ffdf143be42490f05cb2b69cdb83e74264d6070a.tar.bz2
mitmproxy-ffdf143be42490f05cb2b69cdb83e74264d6070a.zip
better exception handling
Diffstat (limited to 'libmproxy/protocol/rawtcp.py')
-rw-r--r--libmproxy/protocol/rawtcp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/libmproxy/protocol/rawtcp.py b/libmproxy/protocol/rawtcp.py
index 6ab0196a..8a597a15 100644
--- a/libmproxy/protocol/rawtcp.py
+++ b/libmproxy/protocol/rawtcp.py
@@ -1,6 +1,8 @@
from __future__ import (absolute_import, print_function, division)
import socket
import select
+import six
+import sys
from OpenSSL import SSL
@@ -63,4 +65,8 @@ class RawTCPLayer(Layer):
)
except (socket.error, NetLibError, SSL.Error) as e:
- raise ProtocolException("TCP connection closed unexpectedly: {}".format(repr(e)), e)
+ six.reraise(
+ ProtocolException,
+ ProtocolException("TCP connection closed unexpectedly: {}".format(repr(e)), e),
+ sys.exc_info()[2]
+ )