🐛 fix(service.py): remove unnecessary try-except block and return statement to improve code readability and maintainability
This commit is contained in:
parent
6615bf3b03
commit
5a8ba5f0db
1 changed files with 2 additions and 7 deletions
|
|
@ -199,13 +199,8 @@ class StoreService(Service):
|
||||||
self.components_url, headers=headers, json=component_dict
|
self.components_url, headers=headers, json=component_dict
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
# ! If the user does not have permission to a certain field
|
component = response.json()["data"]
|
||||||
# the request returns 204 and no data
|
return ComponentResponse(**component)
|
||||||
try:
|
|
||||||
component = response.json()["data"]
|
|
||||||
return ComponentResponse(**component)
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
return ComponentResponse(**component_dict)
|
|
||||||
except HTTPError as exc:
|
except HTTPError as exc:
|
||||||
if response:
|
if response:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue