From 118f14a8e48107e4ca07e147df2892bdad1dbdc6 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 14 Aug 2024 08:56:59 +0200 Subject: [PATCH] update-book2.rb: gracefully warn about missing files, but continue When a file goes missing but is still referenced, as was the case with https://github.com/progit/progit2-zh/pull/507, we do not want the entire book rendering business on https://git-scm.com/ to halt before that bug is fixed. Let's instead warn about this and continue to render the book. Signed-off-by: Johannes Schindelin --- script/update-book2.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/update-book2.rb b/script/update-book2.rb index b4edf0daae..27c05db880 100644 --- a/script/update-book2.rb +++ b/script/update-book2.rb @@ -265,6 +265,9 @@ def local_genbook2(language_code, worktree_path) if language_code && worktree_path book = genbook(language_code) do |filename| File.open(File.join(worktree_path, filename), "r") { |infile| File.read(infile) } + rescue + puts "::error::#{filename} is missing!" + "**ERROR**: _#{filename} is missing_" end if language_code == 'en' latest_tag = `git -C "#{worktree_path}" for-each-ref --format '%(refname:short)' --sort=-committerdate --count=1 refs/tags/`.chomp