Skip to content

Commit 44f9fdb

Browse files
patrickelectricjaxxzer
authored andcommitted
templates: Replace exit with raise exception
This creates issues when this class is used and the error handle can be done Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
1 parent bb4c9c1 commit 44f9fdb

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

generate/templates/device.py.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ class PingDevice(object):
3333
self.iodev.send_break()
3434
self.iodev.write("U".encode("utf-8"))
3535

36-
except Exception as e:
37-
print("Failed to open the given serial port")
38-
print("\t", e)
39-
exit(1)
36+
except Exception as exception:
37+
raise Exception("Failed to open the given serial port: {0}".format(exception))
4038

4139
## A helper class to take care of decoding the input stream
4240
self.parser = pingmessage.PingParser()

0 commit comments

Comments
 (0)