-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handle peripheral device exceptions #5
Labels
Milestone
Comments
Note that even though the program currently stops on exceptions, when using the official distributed kit images, the program is automatically restarted by systemd. However, due to #4, on some configurations the program can only be restarted so many times on a single boot before system resources run out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is expected of peripheral devices that they sometimes behave unpredictably. For example, hardware issues (loose connectors, timing issues) can cause problems with communication. This can lead to a variety of exceptions.
Currently, any such exception stops the program, even though other peripherals might still be working as expected. This can be troublesome especially for kits that are controlling actuators such as lights or climate control, as the control process also stops.
There are multiple ways to implement handling of such exceptions. For example:
Exception
(which does not include e.g.KeyboardInterrupt
andSystemExit
); orPeripheralDeviceException
could be created, with peripheral device code being required to catch exceptions to rethrow asPeripheralDeviceException
.The first alternative works in most cases, but has the con of potentially catching too many exceptions (but which would we not want to catch?). The second alternative is likely to sometimes still fail for some unforeseen exceptions.
Once an exception has been caught for a peripheral device, for now we might simply ignore that device. In the future, an attempt at recovering the device might be implemented.
The text was updated successfully, but these errors were encountered: