diff options
author | James Wen <jrw2175@columbia.edu> | 2015-12-26 14:34:56 -0500 |
---|---|---|
committer | James Wen <jrw2175@columbia.edu> | 2015-12-26 20:24:18 -0500 |
commit | 85d6ceae60cb1be0ca230c93c93bec90675e2145 (patch) | |
tree | c849adbe313a7f44acf190bfe2952f6660f521cf | |
parent | e2b14375c3ed2ef679fed1ca894dd346cbcefcf1 (diff) | |
download | bundler-85d6ceae60cb1be0ca230c93c93bec90675e2145.tar.gz |
Add original error context info to GemRequireError message
-rw-r--r-- | lib/bundler/errors.rb | 6 | ||||
-rw-r--r-- | spec/runtime/require_spec.rb | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb index 75c8c90b..ea2b52a6 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 759aae3e..e2275148 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 |