From 429618986b1e27e70a980f3d46f2d0e85f545395 Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Mon, 11 Jan 2021 16:29:40 -0500 Subject: [PATCH 1/3] Should fix raise-missing-from failure --- adafruit_hue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_hue.py b/adafruit_hue.py index 71b99da..d2f3d7e 100644 --- a/adafruit_hue.py +++ b/adafruit_hue.py @@ -119,7 +119,7 @@ def discover_bridge(self): raise TypeError( "Ensure the Philips Bridge and CircuitPython device\ are both on the same WiFi network." - ) + ) from TypeError self._ip = bridge_ip # set up hue bridge address path self._bridge_url = "http://{}/api".format(self._ip) From b82c54daeaaef4b3470a4b9a9275dc5abe5d8382 Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Mon, 11 Jan 2021 16:49:52 -0500 Subject: [PATCH 2/3] Using correct syntax --- adafruit_hue.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_hue.py b/adafruit_hue.py index d2f3d7e..2d1c787 100644 --- a/adafruit_hue.py +++ b/adafruit_hue.py @@ -115,11 +115,11 @@ def discover_bridge(self): json_data = resp.json() bridge_ip = json_data[0]["internalipaddress"] resp.close() - except: + except Exception as e: raise TypeError( "Ensure the Philips Bridge and CircuitPython device\ are both on the same WiFi network." - ) from TypeError + ) from e self._ip = bridge_ip # set up hue bridge address path self._bridge_url = "http://{}/api".format(self._ip) From 031b3f855fc3c946cc3d522fc20b0e1afe388c9f Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Tue, 12 Jan 2021 10:22:04 -0500 Subject: [PATCH 3/3] Change variable name to err --- adafruit_hue.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_hue.py b/adafruit_hue.py index 2d1c787..2401f87 100644 --- a/adafruit_hue.py +++ b/adafruit_hue.py @@ -115,11 +115,11 @@ def discover_bridge(self): json_data = resp.json() bridge_ip = json_data[0]["internalipaddress"] resp.close() - except Exception as e: + except Exception as err: raise TypeError( "Ensure the Philips Bridge and CircuitPython device\ are both on the same WiFi network." - ) from e + ) from err self._ip = bridge_ip # set up hue bridge address path self._bridge_url = "http://{}/api".format(self._ip)