Staging instance, all changes can be removed at any time

Skip to content

npm.client: Handle packages with no versions

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


Migrated from D1409 (view on Phabricator)

Merge request reports

Loading