Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unreachable logger code when deleting domain and type #40

Closed
jcadam14 opened this issue Sep 17, 2024 · 0 comments · Fixed by #43
Closed

Fix unreachable logger code when deleting domain and type #40

jcadam14 opened this issue Sep 17, 2024 · 0 comments · Fixed by #43
Assignees

Comments

@jcadam14
Copy link
Collaborator

The following logger.errors are unreachable:

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants