Skip to content

Conversation

@Adityakk9031
Copy link

Problem

insert_advisory_v2 uses AdvisoryV2.objects.get_or_create(...), but the except block incorrectly catches Advisory.MultipleObjectsReturned.
When duplicate AdvisoryV2 records exist, Django raises AdvisoryV2.MultipleObjectsReturned, which was not being caught, causing the exception to propagate and break the pipeline.

Solution

Updated the exception handling to catch the correct exception:

Replaced Advisory.MultipleObjectsReturned

With AdvisoryV2.MultipleObjectsReturned

This ensures duplicate AdvisoryV2 records are handled correctly and prevents unexpected crashes during advisory ingestion.

Related Issue

Fixes: Incorrect try except in insert_advisory_v2 #2081
#2081

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 this pull request may close these issues.

1 participant