🐛 fix(store.py): handle exception when counting components to prevent potential errors and set comp_count to 0 in case of exception

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-11-08 16:08:50 -03:00
commit f323bc4d8a

View file

@ -104,12 +104,14 @@ def get_components(
tags=tags, tags=tags,
sort=sort, sort=sort,
) )
try:
comp_count = store_service.count_components( comp_count = store_service.count_components(
api_key=store_api_Key, api_key=store_api_Key,
filter_by_user=filter_by_user, filter_by_user=filter_by_user,
is_component=is_component, is_component=is_component,
) )
except Exception:
comp_count = 0
if store_api_Key: if store_api_Key:
# Now, from the result, we need to get the components # Now, from the result, we need to get the components