Skip to content

Commit

Permalink
refactor: Raise error if is API request status is not OK (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicorinn authored Jul 9, 2023
1 parent 30c676e commit fd9a9f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pytrials/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def request_ct(url):
"""Performs a get request that provides a (somewhat) useful error message."""
try:
response = requests.get(url)
response.raise_for_status()
except requests.HTTPError as ex:
raise ex
except ImportError:
raise ImportError(
"Couldn't retrieve the data, check your search expression or try again later."
Expand Down

0 comments on commit fd9a9f1

Please sign in to comment.