OpenwaterHealth / OpenwaterHealth/openlifu-python
Improve Exception handling in sonication control
Open
@peterhollender is already working on this.
Since Mar 3, 2025.
- Dominant language
- Python
- Stars
- 27
- Forks
- 21
- Avg merge
- 1d 20m
- Merged PRs (30d)
- 6
Description
Currently, the io module (LIFUInterface, LIFUTXDevice, etc) use a number of try... except cases to catch both UART errors and log other exceptions. There are a couple of issues with the way this is handled:
- We are raising
ValueErrors when the communications are failing. This should probably be something more specific if we would like to catch it and print a more detailed Exception message - We are checking for UART connectivity in each method using a very similar snippet of code - this should probably me a method.
- We are catching all other
Exceptions, and logging the error before re-raising it. I think that this is unnecessary, as we can configure the logger to capture thestdoutoutput from unhandled exceptions
I'll work on tidying this up.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.