/browse/search/ crashes when swh-search results are not in swh-storage
swh-search is up to date with the main swh-storage cluster, while swh-web uses a replica that is currently lagging behind. This means that search results returned by swh-search may not exist in the storage.
When this happens, the JS code gets a 404 when querying https://archive.softwareheritage.org/api/1/origin/visit/latest/doc/ with an HTML body.
However, it expects to always get a JSON body, causing this crash:
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON at None (./swh/web/browse/assets/browse/origin-search.js:61:66) at Array.map (<anonymous>) at call (./swh/web/browse/assets/browse/origin-search.js:61:55) ... (3 additional frame(s) were not displayed)
which means the page gets stuck on the "Checking" spinner
Migrated from T4675 (view on Phabricator)