We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
passing various invalid strings to the constructor is causing different errors and exceptions:
ip = 1.1.1
ip = 1.1.1.1
PhueRequestTimeout
socket.timeout
line 743, in connect
line 652, in request
it would be nice to have the following exceptions to be thrown:
Bridge()
PhueConnectionException
PhueTimeoutException
PhueRegistrationException
Hacky solution that is currently working properly accept random socket.timeout:
def bridge_factory(ip): bridge = None # handle import try: from phue import Bridge, PhueRegistrationException, PhueRequestTimeout except ImportError: exit(wording.get('package_no').format('PHUE') + wording.get('exclamation_mark')) # create instance try: bridge = Bridge(ip) except (PhueRequestTimeout, OSError, ValueError): exit(wording.get('connection_no').format('PHILIPS HUE') + wording.get('exclamation_mark')) except PhueRegistrationException: exit(wording.get('press_button').format('PAIRING', 'PHILIPS HUE BRIDGE') + wording.get('exclamation_mark')) return bridge
Wanted solution that throws PhueConnectionException, PhueTimeoutException and PhueRegistrationException:
def bridge_factory(ip): bridge = None # handle import try: from phue import Bridge, PhueRegistrationException, PhueTimeoutException except ImportError: exit(wording.get('package_no').format('PHUE') + wording.get('exclamation_mark')) # create instance try: bridge = Bridge(ip) except (PhueConnectionException, PhueTimeoutException): exit(wording.get('connection_no').format('PHILIPS HUE') + wording.get('exclamation_mark')) except PhueRegistrationException: exit(wording.get('press_button').format('PAIRING', 'PHILIPS HUE BRIDGE') + wording.get('exclamation_mark')) return bridge
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
passing various invalid strings to the constructor is causing different errors and exceptions:
ip = 1.1.1
~ OSError: [Errno 101] Network is unreachableip = 1.1.1.1
~ json.decoder.JSONDecodeError: Expecting valuePhueRequestTimeout
does not always catchsocket.timeout
for some reasonsocket.timeout
online 743, in connect
andline 652, in request
it would be nice to have the following exceptions to be thrown:
Bridge()
so throwPhueConnectionException
PhueTimeoutException
PhueRegistrationException
Hacky solution that is currently working properly accept random
socket.timeout
:Wanted solution that throws
PhueConnectionException
,PhueTimeoutException
andPhueRegistrationException
:The text was updated successfully, but these errors were encountered: