🐛 fix(service.py): remove unnecessary try-except block and improve error handling in GET request
This commit is contained in:
parent
3b14cdbe9f
commit
4c8550579d
1 changed files with 3 additions and 5 deletions
|
|
@ -31,14 +31,12 @@ class StoreService(Service):
|
|||
headers = {}
|
||||
try:
|
||||
response = httpx.get(url, headers=headers, params=params)
|
||||
response_text = response.text
|
||||
response.raise_for_status()
|
||||
return response.json()["data"]
|
||||
except HTTPError as exc:
|
||||
try:
|
||||
raise ValueError(response_text) from exc
|
||||
except Exception:
|
||||
raise ValueError(f"GET request failed: {exc}") from exc
|
||||
raise exc
|
||||
except Exception as exc:
|
||||
raise ValueError(f"GET failed: {exc}")
|
||||
|
||||
def search(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue