serialhdl: Catch os.error on can.interface.Bus() call

It seems opening the canbus socket can sometimes throw an os.error (in
addition to can.CanError).  Catch that error to avoid Klipper
reporting an internal error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2023-06-17 19:29:07 -04:00
parent 38e79dffb6
commit 0245073c55
1 changed files with 1 additions and 1 deletions

View File

@ -136,7 +136,7 @@ class SerialReader:
can_filters=filters, can_filters=filters,
bustype='socketcan') bustype='socketcan')
bus.send(set_id_msg) bus.send(set_id_msg)
except can.CanError as e: except (can.CanError, os.error) as e:
logging.warn("%sUnable to open CAN port: %s", logging.warn("%sUnable to open CAN port: %s",
self.warn_prefix, e) self.warn_prefix, e)
self.reactor.pause(self.reactor.monotonic() + 5.) self.reactor.pause(self.reactor.monotonic() + 5.)