diff options
author | Emily Giurleo <e.m.giurleo@gmail.com> | 2020-01-22 15:29:31 -0500 |
---|---|---|
committer | Emily Giurleo <e.m.giurleo@gmail.com> | 2020-01-22 15:29:31 -0500 |
commit | 7aa323a8396782b351e95bfa3f3456bd2db3c682 (patch) | |
tree | 3c727700d1fedf59d6becb6dc2751b39baedb906 | |
parent | 0fb17fce4068f6f82bcbfca0515e0a40401c3143 (diff) | |
download | bundler-7aa323a8396782b351e95bfa3f3456bd2db3c682.tar.gz |
always print backtrace on LoadError
-rw-r--r-- | lib/bundler/friendly_errors.rb | 2 | ||||
-rw-r--r-- | spec/bundler/friendly_errors_spec.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index 9d8b67f55a..046a666003 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -23,7 +23,7 @@ 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. #{error.class}: #{error}" + 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 \ diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb index db27622b79..125724d3ea 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. LoadError: cannot load such file -- 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 |