Page MenuHomeSoftware Heritage

npm.client: Handle packages with no versions

Authored by anlambert on Apr 11 2019, 3:35 PM.



Some registered packages may not have any version available, resulting in the following error:

[2019-04-11 12:00:12,754: ERROR/ForkPoolWorker-18] Loading failure, updating to `partial` status
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/swh/loader/core/", line 894, in load
  File "/usr/lib/python3/dist-packages/swh/loader/npm/", line 294, in store_data
  File "/usr/lib/python3/dist-packages/swh/loader/npm/", line 264, in _generate_and_load_snapshot
    latest_version = self.npm_client.latest_package_version()
  File "/usr/lib/python3/dist-packages/swh/loader/npm/", line 59, in latest_package_version
    return self.package_metadata['dist-tags']['latest']
KeyError: 'latest'

So fix and test that specific case.

Related T1644

Diff Detail

rDLDNPM npm loader
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

anlambert created this revision.Apr 11 2019, 3:35 PM
olasd accepted this revision.Apr 11 2019, 4:14 PM
This revision is now accepted and ready to land.Apr 11 2019, 4:14 PM
This revision was landed with ongoing or failed builds.Apr 11 2019, 4:38 PM
This revision was automatically updated to reflect the committed changes.