Skip to content

Commit

Permalink
Add: Improve error handling for converting a CPE to the URI format
Browse files Browse the repository at this point in the history
Raise a descriptive error message during converting a CPE to the URI
format (CPE v2.2) if transforming a part of the CPE fails.
  • Loading branch information
bjoernricks committed Nov 3, 2023
1 parent a4d68fd commit 174c5fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pontos/cpe/_cpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ def bind_value_for_uri(value: Optional[str]) -> str:
return ""
if value == NA:
return value
return _transform_for_uri(value)
try:
return _transform_for_uri(value)
except Exception as e:
raise CPEParsingError(f"Can't bind '{value}' for URI") from e


def unbind_value_uri(value: Optional[str]) -> Optional[str]:
Expand Down

0 comments on commit 174c5fa

Please sign in to comment.