From 8aa22ea939d3034cb4e11d999139ac806f75f7f2 Mon Sep 17 00:00:00 2001 From: zyoshoka <107108195+zyoshoka@users.noreply.github.com> Date: Sat, 1 Feb 2025 00:37:52 +0900 Subject: [PATCH] utils/github: fix GraphQL error log The key `type` is not included in the response, making the log look weird. --- Library/Homebrew/utils/github.rb | 4 +--- Library/Homebrew/utils/github/api.rb | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 156c76b445..36a9aa14c1 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -480,9 +480,7 @@ module GitHub end # Only raise errors if we didn't get any sponsorships. - if sponsorships.blank? && errors.present? - raise API::Error, errors.map { |e| "#{e["type"]}: #{e["message"]}" }.join("\n") - end + raise API::Error, errors.map { |e| e["message"] }.join("\n") if sponsorships.blank? && errors.present? sponsorships.map do |sponsorship| sponsor = sponsorship["sponsorEntity"] diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index f9a5219316..6891ebf740 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -329,9 +329,7 @@ module GitHub result = open_rest("#{API_URL}/graphql", scopes:, data:, request_method: "POST") if raise_errors - if result["errors"].present? - raise Error, result["errors"].map { |e| "#{e["type"]}: #{e["message"]}" }.join("\n") - end + raise Error, result["errors"].map { |e| e["message"] }.join("\n") if result["errors"].present? result["data"] else