delete_domains = repo.delete_domains_by_lei(session, lei)
if not delete_domains:
logger.error(f"Domain(s) for LEI {lei} not deleted.")
delete_sbl_type = repo.delete_sbl_type_by_lei(session, lei)
if not delete_sbl_type:
logger.error(f"sbl type(s) for LEI {lei} not deleted.")
In the repo functions, the filter will cause non-existant domains or types to not do anything, but the delete_domains and delete_sbl_type objects will still exist, so the logger.errors wouldn't be hit. If there is an exception in the repo functions, it would be raised prior to the logger.error, making those statements unreachable. Rewrite this logic to properly log if either domains or types are missing (prior to trying to delete, so will need to check the results of the filter first then delete)
Make the logger.error into warnings since it's very possible we will have LEIs without associated domains/types.
The following logger.errors are unreachable:
In the repo functions, the filter will cause non-existant domains or types to not do anything, but the delete_domains and delete_sbl_type objects will still exist, so the logger.errors wouldn't be hit. If there is an exception in the repo functions, it would be raised prior to the logger.error, making those statements unreachable. Rewrite this logic to properly log if either domains or types are missing (prior to trying to delete, so will need to check the results of the filter first then delete)
Make the logger.error into warnings since it's very possible we will have LEIs without associated domains/types.