diff options
author | Sarah German <sgerman@gitlab.com> | 2023-02-01 16:31:12 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2023-02-01 16:31:12 +0300 |
commit | 41e2dd52641d97bad9bb1fd630e23bd8d7b4d6ff (patch) | |
tree | 00e99906be9762b126d5ea22f8c8a05bb8168505 /Rules | |
parent | afefd480f4d05b48c9a890911d75a2965678ade8 (diff) |
Avoid fatal errors if unable to retrieve versions.json
Diffstat (limited to 'Rules')
-rw-r--r-- | Rules | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -54,13 +54,14 @@ preprocess do config[:search_backend] = ENV['SEARCH_BACKEND'] || 'algolia' def get_online_versions - uri = URI('https://gitlab.com/gitlab-org/gitlab-docs/-/raw/main/content/versions.json') - response = Net::HTTP.get(uri) - parsed = JSON.parse(response, symbolize_names: true) - parsed[0] + uri = URI('https://gitlab.com/gitlab-org/gitlab-docs/-/raw/main/content/versions.json') + response = Net::HTTP.get(uri) + parsed = JSON.parse(response, symbolize_names: true) + parsed[0] + rescue + {} end config[:online_versions] = get_online_versions - end compile '/404.*' do |