🐛 fix(service.py): remove unnecessary try-except block and return statement to improve code readability and maintainability

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-26 14:45:49 -03:00
commit 5a8ba5f0db

View file

@ -199,13 +199,8 @@ class StoreService(Service):
self.components_url, headers=headers, json=component_dict
)
response.raise_for_status()
# ! If the user does not have permission to a certain field
# the request returns 204 and no data
try:
component = response.json()["data"]
return ComponentResponse(**component)
except json.JSONDecodeError:
return ComponentResponse(**component_dict)
component = response.json()["data"]
return ComponentResponse(**component)
except HTTPError as exc:
if response:
try: