Skip to content

Commit

Permalink
Improve error reporting on w examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ZodiusInfuser committed Oct 10, 2024
1 parent 9126be4 commit 5979063
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions examples/tiny_fx_w/examples/wireless/cheerlights.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

try:
from secrets import WIFI_SSID, WIFI_PASSWORD
if len(WIFI_SSID) == 0:
raise ValueError("no WiFi network set. Open the 'secrets.py' file on your device to add your WiFi credentials")
except ImportError:
print("Create secrets.py with your WiFi credentials")
raise
raise ImportError("no module named 'secrets'. Create a 'secrets.py' file on your device with your WiFi credentials")


# Constants
Expand All @@ -33,6 +34,7 @@
try:
# Connect to WLAN
wlan.active(True)
print(f"Connecting to network '{WIFI_SSID}'")
wlan.connect(WIFI_SSID, WIFI_PASSWORD)

# Wait until the connection is established
Expand Down
6 changes: 4 additions & 2 deletions examples/tiny_fx_w/examples/wireless/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

try:
from secrets import WIFI_SSID, WIFI_PASSWORD
if len(WIFI_SSID) == 0:
raise ValueError("no WiFi network set. Open the 'secrets.py' file on your device to add your WiFi credentials")
except ImportError:
print("Create secrets.py with your WiFi credentials")
raise
raise ImportError("no module named 'secrets'. Create a 'secrets.py' file on your device with your WiFi credentials")


# Constants
Expand All @@ -33,6 +34,7 @@
try:
# Connect to WLAN
wlan.active(True)
print(f"Connecting to network '{WIFI_SSID}'")
wlan.connect(WIFI_SSID, WIFI_PASSWORD)

# Wait until the connection is established
Expand Down

0 comments on commit 5979063

Please sign in to comment.