🐛 fix(service.py): remove unnecessary try-except block and improve error handling in GET request

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-20 11:08:38 -03:00
commit 4c8550579d

View file

@ -31,14 +31,12 @@ class StoreService(Service):
headers = {} headers = {}
try: try:
response = httpx.get(url, headers=headers, params=params) response = httpx.get(url, headers=headers, params=params)
response_text = response.text
response.raise_for_status() response.raise_for_status()
return response.json()["data"] return response.json()["data"]
except HTTPError as exc: except HTTPError as exc:
try: raise exc
raise ValueError(response_text) from exc except Exception as exc:
except Exception: raise ValueError(f"GET failed: {exc}")
raise ValueError(f"GET request failed: {exc}") from exc
def search( def search(
self, self,