You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's quiet confusing if parse_file do not complain if there is a ValueError or a KeyError. I just a get an empty doc. It would be nice to catch the full trace with an exception to actually see what is failing. If you still want the debugging message you can catch them but please re-raise the exception or raise a own exception like ParsingError and describe there in detail what failed.
... or at least returning the errors.
Like that, I had to change the code (just adding ... as err:) and set there a breakpoint to see what was going on. I would also suggest to use a logger or print on stderr instead of stdout.
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion @jloehel I have tried to be as flexible and tolerant as possible with the parsing but you are right, a lib4sbom defined exception would be a better solution.
@anthonyharrison Maybe one suggestion more. I would raise it like raise SBOMParserException(f"Unable to process file {sbom_file}") from e , to understand the root cause of the failure.
It's quiet confusing if
parse_file
do not complain if there is a ValueError or a KeyError. I just a get an empty doc. It would be nice to catch the full trace with an exception to actually see what is failing. If you still want the debugging message you can catch them but please re-raise the exception or raise a own exception likeParsingError
and describe there in detail what failed.... or at least returning the errors.
lib4sbom/lib4sbom/parser.py
Lines 120 to 125 in 7901844
Like that, I had to change the code (just adding
... as err:
) and set there a breakpoint to see what was going on. I would also suggest to use a logger or print on stderr instead of stdout.The text was updated successfully, but these errors were encountered: