Merge pull request #110 from csboling/csboling-patch-1
raise ReaderThread exceptions in connection_lost
diff --git a/serial/threaded/__init__.py b/serial/threaded/__init__.py
index 5fd3bc9..7bdd4d8 100644
--- a/serial/threaded/__init__.py
+++ b/serial/threaded/__init__.py
@@ -30,6 +30,8 @@
Called when the serial port is closed or the reader loop terminated
otherwise.
"""
+ if isinstance(exc, Exception):
+ raise exc
class Packetizer(Protocol):
@@ -53,6 +55,7 @@
def connection_lost(self, exc):
"""Forget transport"""
self.transport = None
+ super(Packetizer, self).connection_lost(exc)
def data_received(self, data):
"""Buffer received data, find TERMINATOR, call handle_packet"""
@@ -90,6 +93,7 @@
self.transport = None
self.in_packet = False
del self.packet[:]
+ super(FramedPacket, self).connection_lost(exc)
def data_received(self, data):
"""Find data enclosed in START/STOP, call handle_packet"""