Remove unnecessary try-catch
With the introduction of atomic transaction in previous commit, it is
unnecessary to catch the erroneous Advisory because if there's an exception
all the changes will be rolled back anyway.
@@ -120,7 +120,6 @@ def process_advisories(data_source: DataSource) -> None:
advisory_batches = chain(data_source.updated_advisories(), data_source.added_advisories())
for batch in advisory_batches:
for advisory in batch:
- try:
vuln, vuln_created = _get_or_create_vulnerability(advisory)
for vuln_ref in advisory.references:
ref, _ = models.VulnerabilityReference.objects.get_or_create(
@@ -154,12 +153,6 @@ def process_advisories(data_source: DataSource) -> None:
prv.patched_package = patched_package
prv.save()
- except Exception:
- # TODO: store error but continue
- logger.error(
- f"Failed to process advisory: {advisory!r}:\n" + traceback.format_exc()
- )
-
models.PackageRelatedVulnerability.objects.bulk_create(
[i.to_model_object() for i in bulk_create_vuln_pkg_refs]
)
