Skip to content

Commit

Permalink
Merge pull request #19182 from zyoshoka/utils/github/fix-graphql-erro…
Browse files Browse the repository at this point in the history
…r-log

utils/github: fix GraphQL error log
  • Loading branch information
MikeMcQuaid authored Jan 31, 2025
2 parents f778d21 + 8aa22ea commit d672589
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Library/Homebrew/utils/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,7 @@ def self.sponsorships(user)
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"]
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/utils/github/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,7 @@ def self.open_graphql(query, variables: nil, scopes: [].freeze, raise_errors: tr
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
Expand Down

0 comments on commit d672589

Please sign in to comment.