summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2015-12-27 18:43:43 +0900
committerHomu <homu@barosl.com>2015-12-27 18:43:43 +0900
commitba0bac9761408f98b9ca806bbfd52b1de414513d (patch)
tree091b6bcfb4d855cdda5b7403864db577e42c685a
parentf61747e83ecea99a8c73c9ca104edddfbac1d89f (diff)
parent85d6ceae60cb1be0ca230c93c93bec90675e2145 (diff)
downloadbundler-ba0bac9761408f98b9ca806bbfd52b1de414513d.tar.gz
Auto merge of #4187 - RochesterinNYC:add-more-info-to-gem-require-error, r=indirect
Add original error context info to GemRequireError message Addresses #4182.
-rw-r--r--lib/bundler/errors.rb6
-rw-r--r--spec/runtime/require_spec.rb3
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb
index 75c8c90b88..ea2b52a6fb 100644
--- a/lib/bundler/errors.rb
+++ b/lib/bundler/errors.rb
@@ -41,7 +41,11 @@ module Bundler
attr_reader :orig_exception
def initialize(orig_exception, msg)
- super(msg)
+ full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
+ "Backtrace for gem load error is:\n"\
+ "#{orig_exception.backtrace.join("\n")}\n"\
+ "Bundler Error Backtrace:\n"
+ super(full_message)
@orig_exception = orig_exception
end
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index 759aae3e47..e227514838 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -100,7 +100,7 @@ describe "Bundler.require" do
it "displays a helpful message if the required gem throws an error" do
build_lib "faulty", "1.0.0" do |s|
- s.write "lib/faulty.rb", "HI"
+ s.write "lib/faulty.rb", "raise RuntimeError.new(\"Gem Internal Error Message\")"
end
gemfile <<-G
@@ -110,6 +110,7 @@ describe "Bundler.require" do
run "Bundler.require", :expect_err => true
expect(err).to match("error while trying to load the gem 'faulty'")
+ expect(err).to match("Gem Internal Error Message")
end
it "doesn't swallow the error when the library has an unrelated error" do