Skip to content

Refactor CVS create vulnerability service to return early instead of raising an error when no finding maps are created

Summary

The VulnerabilityScanning::CreateVulnerabilityScanning class raises an error when it does not create any finding maps. This works to return early from the scan, but the tracked exception doesn't provide any additional info. Individual errors are already tracked, and the raised exception does not provide actionable context on its own.

        raise StandardError, "No vulnerability scanning finding maps could be created" if maps.empty?

Improvements

  • Remove unneeded noise from Sentry errors. We cannot action them, so they detract from addressing other issues.
  • Make it easier to follow the code. Raising errors increase the cognitive load of keeping all raised error paths.

Risks

None

Involved components

Optional: Intended side effects

Remove a StandardError from Sentry

Optional: Missing test coverage