summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2020-01-23 13:37:00 +0000
committerBundlerbot <bot@bundler.io>2020-01-23 13:37:00 +0000
commit524f524362666cb80700430b9f3740f38befb027 (patch)
tree265fddd19ac4f17a5a0c6f54fb952419e9674632
parent12b786888e630a6141273d28b74ec4b2e075cc44 (diff)
parent7aa323a8396782b351e95bfa3f3456bd2db3c682 (diff)
downloadbundler-524f524362666cb80700430b9f3740f38befb027.tar.gz
Merge #7527
7527: Report original exception when failing to load openssl r=deivid-rodriguez a=p-mongo ### What was the end-user problem that led to this PR? See #7192. ### What was your diagnosis of the problem? Bundler discards `LoadError` class and message when reporting it. ### What is your fix for the problem, implemented in this PR? Report class and message of the original exception when reporting `LoadError`. Fixes #7192 Co-authored-by: Oleg Pudeyev <oleg@bsdpower.com> Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net> Co-authored-by: Emily Giurleo <e.m.giurleo@gmail.com>
-rw-r--r--lib/bundler/friendly_errors.rb3
-rw-r--r--spec/bundler/friendly_errors_spec.rb11
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index 080697b02c..046a666003 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -23,13 +23,12 @@ module Bundler
Bundler.ui.error error.message
when LoadError
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
- Bundler.ui.error "\nCould not load OpenSSL."
+ Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
Bundler.ui.warn <<-WARN, :wrap => true
You must recompile Ruby with OpenSSL support or change the sources in your \
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
using RVM are available at https://rvm.io/packages/openssl.
WARN
- Bundler.ui.trace error
when Interrupt
Bundler.ui.error "\nQuitting..."
Bundler.ui.trace error
diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb
index 82553a3ca7..e7addda3f2 100644
--- a/spec/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/friendly_errors_spec.rb
@@ -115,8 +115,12 @@ RSpec.describe Bundler, "friendly errors" do
context "LoadError" do
let(:error) { LoadError.new("cannot load such file -- openssl") }
+ before do
+ allow(error).to receive(:backtrace).and_return(["backtrace"])
+ end
+
it "Bundler.ui receive error" do
- expect(Bundler.ui).to receive(:error).with("\nCould not load OpenSSL.")
+ expect(Bundler.ui).to receive(:error).with("\nCould not load OpenSSL. LoadError: cannot load such file -- openssl\nbacktrace")
Bundler::FriendlyErrors.log_error(error)
end
@@ -124,11 +128,6 @@ RSpec.describe Bundler, "friendly errors" do
expect(Bundler.ui).to receive(:warn).with(any_args, :wrap => true)
Bundler::FriendlyErrors.log_error(error)
end
-
- it "Bundler.ui receive trace" do
- expect(Bundler.ui).to receive(:trace).with(error)
- Bundler::FriendlyErrors.log_error(error)
- end
end
context "Interrupt" do