Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Rules
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2023-02-01 16:31:12 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2023-02-01 16:31:12 +0300
commit41e2dd52641d97bad9bb1fd630e23bd8d7b4d6ff (patch)
tree00e99906be9762b126d5ea22f8c8a05bb8168505 /Rules
parentafefd480f4d05b48c9a890911d75a2965678ade8 (diff)
Avoid fatal errors if unable to retrieve versions.json
Diffstat (limited to 'Rules')
-rw-r--r--Rules11
1 files changed, 6 insertions, 5 deletions
diff --git a/Rules b/Rules
index bab425bb..c6c3fe53 100644
--- a/Rules
+++ b/Rules
@@ -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