Fix error handling for non existent serial ports
This commit is contained in:
parent
d6bf061c65
commit
9ce43d542c
1 changed files with 2 additions and 3 deletions
|
@ -73,10 +73,9 @@ class MattchBox(Controller):
|
||||||
try:
|
try:
|
||||||
self.ser.open()
|
self.ser.open()
|
||||||
self.logger.log.info("Connected to serial port {}".format(port))
|
self.logger.log.info("Connected to serial port {}".format(port))
|
||||||
except serial.SerialException as e:
|
except (FileNotFoundError, serial.SerialException) as e:
|
||||||
self.logger.log.error(
|
self.logger.log.error(
|
||||||
"Could not open serial port" + str(port),
|
"Could not open serial port {}:\n{}".format(port, e)
|
||||||
e
|
|
||||||
)
|
)
|
||||||
self._disconnected()
|
self._disconnected()
|
||||||
self.ser = None
|
self.ser = None
|
||||||
|
|
Loading…
Reference in a new issue