Fix error handling for non existent serial ports

This commit is contained in:
Matthew Stratford 2021-09-02 21:10:37 +01:00
parent d6bf061c65
commit 9ce43d542c

View file

@ -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