From c740bef17698c09ea091ea3a452c29103fe56771 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:00:53 +0800 Subject: [PATCH] utils/github: improve sponsorships error handling Let's make sure we get the opportunity to print the errors if the query response doesn't have the form we expected it to take. --- Library/Homebrew/utils/github.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index ca64c4741c..ccd29deb4e 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -467,7 +467,9 @@ module GitHub # This has been reported to GitHub. errors += result["errors"] if result["errors"].present? - current_sponsorships = result["data"]["organization"]["sponsorshipsAsMaintainer"] + current_sponsorships = result.dig("data", "organization", "sponsorshipsAsMaintainer") + # if `current_sponsorships` is blank, then there should be errors to report. + next { "hasNextPage" => false } if current_sponsorships.blank? # The organisations mentioned above will show up as nil nodes. if (nodes = current_sponsorships["nodes"].compact.presence)