Skip to content

Commit

Permalink
Always raise Exception for status_code != 200
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotwutingfeng committed Feb 19, 2024
1 parent c57cca1 commit 8c8eaa1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions train_arrival.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def _get(url, params=None): # type: (str, dict[str, str] | None) -> str
data = f.read().decode("utf-8")
_ = json.loads(data) # Validate JSON string.
return data
logger.error(status_code)
return "{}"
raise Exception(status_code)
except Exception as e:
logger.error(e)
return "{}"
Expand Down

0 comments on commit 8c8eaa1

Please sign in to comment.