Skip to content

Provide a friendlier exception fhen no usb backend found on unix-like systems#123

Merged
robberwick merged 2 commits intoarvydas:release/2.0-devfrom
robberwick:release/no-libusb-installed
Feb 23, 2025
Merged

Provide a friendlier exception fhen no usb backend found on unix-like systems#123
robberwick merged 2 commits intoarvydas:release/2.0-devfrom
robberwick:release/no-libusb-installed

Conversation

@robberwick
Copy link
Collaborator

This pull request includes changes to improve error handling in the blinkstick library, 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 for USBBackendNotAvailable exception and updated the get_attached_blinkstick_devices method to raise this exception if the USB backend is not available. [1] [2]
  • src/blinkstick/exceptions.py: Added a new USBBackendNotAvailable exception class to handle cases where the USB backend is not available.

@robberwick robberwick requested a review from Copilot February 23, 2025 08:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

@robberwick robberwick force-pushed the release/no-libusb-installed branch from 2c9b325 to db29e7e Compare February 23, 2025 09:04
@robberwick robberwick merged commit 774e041 into arvydas:release/2.0-dev Feb 23, 2025
17 checks passed
@robberwick robberwick deleted the release/no-libusb-installed branch February 23, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants