Page MenuHomeSoftware Heritage

npm.client: Handle packages with no versions
ClosedPublic

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

Details

Summary

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/loader.py", line 894, in load
    self.store_data()
  File "/usr/lib/python3/dist-packages/swh/loader/npm/loader.py", line 294, in store_data
    self._generate_and_load_snapshot()
  File "/usr/lib/python3/dist-packages/swh/loader/npm/loader.py", line 264, in _generate_and_load_snapshot
    latest_version = self.npm_client.latest_package_version()
  File "/usr/lib/python3/dist-packages/swh/loader/npm/client.py", 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

Repository
rDLDNPM npm loader
Branch
missing-latest-version
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5338
Build 7239: tox-on-jenkinsJenkins
Build 7238: arc lint + arc unit