-
-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: Display a warning (instead of exiting early) when unable to find recent issues on a tap #17182
fix: Display a warning (instead of exiting early) when unable to find recent issues on a tap #17182
Conversation
…on and unable to find related issues Occasionally, when failing to `brew install` or `brew upgrade` a formula, users will get an error message and the last line of it will be: ``` Error: Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] ``` Here's an old public example: https://gitlab.com/tabos/rogerrouter/-/issues/21 At Square, this error can be caused by a transient issue with a user's GitHub credentials. My proposal is that any error which prevents `brew` from showing related issues should: 1. Not cause `brew` to exit early (vs. printing diagnostic checks and doing any other cleanup) 2. Be clearly differentiated from the original failure (so it doesn't become a red herring for users troubleshooting their broken formula)
rescue GitHub::API::RateLimitExceededError => e | ||
opoo e.message | ||
rescue GitHub::API::Error => e | ||
opoo "Unable to query GitHub for recent issues on the tap\n#{e.message}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added text to the beginning of the error message to explain that the error isn't related to the original exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes perfect sense to me. There is no reason we should be failing inside an error while querying Github so catching all Github API errors is reasonable. It's only used to print some extra debug information anyway so skipping it isn't the end of the world if the request fails for some reason.
It seems to only be used here.
brew/Library/Homebrew/exceptions.rb
Lines 543 to 546 in c2ed332
if issues.present? | |
puts "These open issues may also help:" | |
puts issues.map { |i| "#{i["title"]} #{i["html_url"]}" }.join("\n") | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thanks again @boblail! |
Thanks all! |
Occasionally, when failing to
brew install
orbrew upgrade
a formula, users will get an error message and the last line of it will be:Here's an old public example: https://gitlab.com/tabos/rogerrouter/-/issues/21
At Square, this error can be caused by a transient issue with a user's GitHub credentials.
My proposal is that any error which prevents
brew
from showing related issues should:brew
to exit early (vs. printing diagnostic checks and doing any other cleanup)brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?