Provide a friendlier exception fhen no usb backend found on unix-like systems#123
Merged
robberwick merged 2 commits intoarvydas:release/2.0-devfrom Feb 23, 2025
Merged
Conversation
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/blinkstick/backends/unix_like.py:48
- [nitpick] Consider enhancing the error message raised for the USB backend unavailability by providing additional guidance—such as a reference or suggestion for installing libusb—to help users resolve the issue.
except usb.core.NoBackendError:
2c9b325 to
db29e7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request includes changes to improve error handling in the
blinksticklibrary, specifically within the Unix-like backend. The most important changes include adding a new exception for USB backend availability and updating the device discovery method to handle this new exception. This exception specifically mentions the availability of libusb, to provide improved signposting towards remediation for users.Error handling improvements:
src/blinkstick/backends/unix_like.py: Added import forUSBBackendNotAvailableexception and updated theget_attached_blinkstick_devicesmethod to raise this exception if the USB backend is not available. [1] [2]src/blinkstick/exceptions.py: Added a newUSBBackendNotAvailableexception class to handle cases where the USB backend is not available.