Skip to content

Fix logging in import runner - #1809

Open
kunalsz wants to merge 1 commit into
aboutcode-org:mainfrom
kunalsz:fix-import-runner
Open

Fix logging in import runner#1809
kunalsz wants to merge 1 commit into
aboutcode-org:mainfrom
kunalsz:fix-import-runner

Conversation

@kunalsz

@kunalsz kunalsz commented Mar 11, 2025

Copy link
Copy Markdown

In reference to the issue #1477

Changes made:

  • In import_runner.py the logging message has been changed from
except ValidationError as e:
        logger.warning(f"Invalid vulnerability reference: {reference!r}: {e}")

to

except ValidationError as e:
        error_message = str(e)
        if "Vulnerability reference with this Url already exists." in error_message:
            logger.debug(f"Duplicate vulnerability reference ignored: {reference!r}")
        else:
            logger.warning(f"Invalid vulnerability reference: {reference!r}: {e}")
  • This ensures that

    • Duplicate reference messages no longer appear as warnings but be logged in debug mode logger.debug
    • Other validation errors should still be logged as warnings
  • Tests created to ensure proper logging of error messages

Signed-off-by: kunalsz <kunalavengers@gmail.com>
@kunalsz kunalsz changed the title Fixed logging in import runner Fix logging in import runner Mar 26, 2025
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