-
Notifications
You must be signed in to change notification settings - Fork 275
Open
Labels
cleanupCode hygiene and cleanupCode hygiene and cleanupenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersneeds-gcp-infra-accessTo be able to adequately work on this issue will require access to GCP infrastructureTo be able to adequately work on this issue will require access to GCP infrastructure
Description
For example, importer could fail to parse a record it is trying to import. Currently if it fails and causes an exception, we do not get the context about what the record filename caused this issue. Wrap the potential failing function and reraise it with additional context about the file name and source.
Example exception we are currently getting.
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/bin/importer.py", line 291, in run
self.process_updates(source_repo)
File "/usr/local/bin/importer.py", line 986, in process_updates
self._process_updates_rest(source_repo)
File "/usr/local/bin/importer.py", line 907, in _process_updates_rest
vulns = osv.parse_vulnerabilities_from_data(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/osv/sources.py", line 146, in parse_vulnerabilities_from_data
data = json.loads(data_text)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/decoder.py", line 338, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/decoder.py", line 356, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Metadata
Metadata
Assignees
Labels
cleanupCode hygiene and cleanupCode hygiene and cleanupenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersneeds-gcp-infra-accessTo be able to adequately work on this issue will require access to GCP infrastructureTo be able to adequately work on this issue will require access to GCP infrastructure