diff --git a/cve_bin_tool/version_compare.py b/cve_bin_tool/version_compare.py index c365a96474..c01135d205 100644 --- a/cve_bin_tool/version_compare.py +++ b/cve_bin_tool/version_compare.py @@ -14,6 +14,11 @@ """ +class CannotParseVersionException(Exception): + """ + Thrown if the version doesn't comply with our expectations + """ + def parse_version(version_string: str): """ Splits a version string into an array for comparison. @@ -54,11 +59,11 @@ def parse_version(version_string: str): versionArray.append(result[0][0]) versionArray.append(result[0][1]) else: - print(f"Cannot parse version {version_string}") + raise CannotParseVersionException(f"version string = {versionString}") # If all else fails, complain else: - print(f"What is {section} supposed to be?") + raise CannotParseVersionException(f"version string = {versionString}") return versionArray