Skip to content

Commit

Permalink
Merge pull request #68 from datastax/feature/#59-error-handling
Browse files Browse the repository at this point in the history
Remove try/except block for failed requests
  • Loading branch information
erichare committed Oct 30, 2023
2 parents e863de3 + 16837bc commit 5c2af2b
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions astrapy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,16 @@ def make_request(
json_data=None,
url_params=None,
):
try:
r = requests.request(
method=method,
url=f"{base_url}{path}",
params=url_params,
json=json_data,
timeout=DEFAULT_TIMEOUT,
headers={auth_header: token, "User-Agent": f"{package_name}/{__version__}"},
)

return r
except Exception as e:
logger.warning(e)

return {"error": "An unknown error occurred", "details": str(e)}
r = requests.request(
method=method,
url=f"{base_url}{path}",
params=url_params,
json=json_data,
timeout=DEFAULT_TIMEOUT,
headers={auth_header: token, "User-Agent": f"{package_name}/{__version__}"},
)

return r


def make_payload(top_level, **kwargs):
Expand Down

0 comments on commit 5c2af2b

Please sign in to comment.