Skip to content

Commit 8226ab4

Browse files
get_local_time is expected to raise RuntimeError when it fails
When response.status_code != 200 from the REST api to TIME_SERVICE the code raises ValueError, which is not what all the examples in Adafruit_Learning_System_Guides handle gracefully. Instead, this situation should be raising the RuntimeError exception. Fixes #96 .
1 parent 2ac9269 commit 8226ab4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_pyportal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def get_local_time(self, location=None):
722722
try:
723723
response = requests.get(api_url, timeout=10)
724724
if response.status_code != 200:
725-
raise ValueError(response.text)
725+
raise RuntimeError(response.text)
726726
if self._debug:
727727
print("Time request: ", api_url)
728728
print("Time reply: ", response.text)

0 commit comments

Comments
 (0)