hardbyte / hardbyte/python-can
Graceful exception handling in Notifier thread
- Lingua principale
- Python
- Stelle
- 1.6k
- Fork
- 697
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The notifier module does not handle exceptions well. Some drivers (in this case) throw an exception if there is no other participant on the bus yet (messages are not ACKed) which effectively kills the listener thread of the Notifier class. If asyncio is used (loop=valid object) this leads to a gap and possible messages are lost.
A list of errors to be suppressed should be added to the Notifier class, enabling the user to disable certain errors. Alternatively, (at least) the iscan module needs to be rewritten not to forward any errors.
The following workaround is in place here:
```
class Notifier(can.Notifier):
def _rx_thread(self, bus):
while self._running:
try:
super()._rx_thread(bus)
except can.interfaces.iscan.IscanError:
pass
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.