Skip to content

Commit f574f9f

Browse files
Merge pull request #4663 from rubygems/better_server_errors
Don't print bug report template on server side errors (cherry picked from commit 481c89a)
1 parent db30029 commit f574f9f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

bundler/lib/bundler/friendly_errors.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ def log_error(error)
4949
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
5050
else request_issue_report_for(error)
5151
end
52-
rescue StandardError
53-
raise error
5452
end
5553

5654
def exit_status(error)
@@ -111,7 +109,7 @@ def request_issue_report_for(e)
111109
First, try this link to see if there are any existing issue reports for this error:
112110
#{issues_url(e)}
113111
114-
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
112+
If there aren't any reports for this error yet, please copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
115113
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md
116114
EOS
117115
end

bundler/lib/bundler/rubygems_integration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ def download_gem(spec, uri, path)
526526
Bundler::Retry.new("download gem from #{uri}").attempts do
527527
fetcher.download(spec, uri, path)
528528
end
529+
rescue Gem::RemoteFetcher::FetchError => e
530+
raise Bundler::HTTPError, "Could not download gem from #{uri} due to underlying error <#{e.message}>"
529531
end
530532

531533
def gem_remote_fetcher

bundler/spec/install/global_cache_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def source2_global_cache(*segments)
113113
expect(source2_global_cache("rack-0.9.1.gem")).to exist
114114
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
115115
expect(err).to include("Internal Server Error 500")
116+
expect(err).not_to include("please copy and paste the report template above into a new issue")
117+
116118
# rack 1.0.0 is not installed and rack 0.9.1 is not
117119
expect(the_bundle).not_to include_gems "rack 1.0.0"
118120
expect(the_bundle).not_to include_gems "rack 0.9.1"
@@ -126,6 +128,8 @@ def source2_global_cache(*segments)
126128
expect(source2_global_cache("rack-0.9.1.gem")).to exist
127129
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
128130
expect(err).to include("Internal Server Error 500")
131+
expect(err).not_to include("please copy and paste the report template above into a new issue")
132+
129133
# rack 0.9.1 is not installed and rack 1.0.0 is not
130134
expect(the_bundle).not_to include_gems "rack 0.9.1"
131135
expect(the_bundle).not_to include_gems "rack 1.0.0"

0 commit comments

Comments
 (0)