Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Add original error context info to GemRequireError message #4187

Merged
merged 1 commit into from
Dec 27, 2015
Merged

Add original error context info to GemRequireError message #4187

merged 1 commit into from
Dec 27, 2015

Conversation

RochesterinNYC
Copy link
Contributor

Addresses #4182.

@RochesterinNYC
Copy link
Contributor Author

Hm, actually, @indirect, any tips on a quick way to reproduce the error condition without requiring something running stuff in a Docker container or uninstalling my node environment? I'd like to check the formatting and see if it's clean looking.

super(msg)
full_message = msg + "\nError was: #{orig_exception.message}\n"\
"Backtrace for gem load error was:\n"\
"#{orig_exception.backtrace.inspect}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backtrace should be joined rather than inspected.

@segiddins
Copy link
Member

Build a gem that just raises in the file bundler will attempt to require?

@RochesterinNYC
Copy link
Contributor Author

Got y'all. Updated the PR with a change to the appropriate spec and updated the formatting.
The output will now look like:

/path/bundler/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'faulty'. (Bundler::GemRequireError)
Gem Load Error is: Gem Internal Error Message
Backtrace for gem load error is:
/path/bundler/tmp/libs/faulty-1.0.0/lib/faulty.rb:1:in `<top (required)>'
/path/bundler/lib/bundler/runtime.rb:77:in `require'
/path/bundler/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
/path/bundler/lib/bundler/runtime.rb:72:in `each'
/path/bundler/lib/bundler/runtime.rb:72:in `block in require'
/path/bundler/lib/bundler/runtime.rb:61:in `each'
/path/bundler/lib/bundler/runtime.rb:61:in `require'
/path/bundler/lib/bundler.rb:100:in `require'
-e:2:in `<main>'
Bundler Error Backtrace:
  from /path/bundler/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
  from /path/bundler/lib/bundler/runtime.rb:72:in `each'
  from /path/bundler/lib/bundler/runtime.rb:72:in `block in require'
  from /path/bundler/lib/bundler/runtime.rb:61:in `each'
  from /path/bundler/lib/bundler/runtime.rb:61:in `require'
  from /path/bundler/lib/bundler.rb:100:in `require'
  from -e:2:in `<main>'

The backtrace for the gem load error would, for the coffee-rails example that the original issue #4182 brought up, be all stuff in the internals of the coffee-rails gem presumably. It's only still bundler-related code/files in backtrace for this example output because this is copied from the test suite.

@segiddins
Copy link
Member

👍🏻

@indirect
Copy link
Member

@homu r+

@homu
Copy link
Contributor

homu commented Dec 27, 2015

📌 Commit 85d6cea has been approved by indirect

@homu
Copy link
Contributor

homu commented Dec 27, 2015

⌛ Testing commit 85d6cea with merge ba0bac9...

homu added a commit that referenced this pull request Dec 27, 2015
…or, r=indirect

Add original error context info to GemRequireError message

Addresses #4182.
@homu
Copy link
Contributor

homu commented Dec 27, 2015

☀️ Test successful - status

@emirkin
Copy link

emirkin commented Mar 13, 2016

@RochesterinNYC what is the simplest way to pick up this fix considering that the new version of Bundler won't be released for a while?

@RochesterinNYC
Copy link
Contributor Author

@emirkin a new release of v1.12.0 will be made very soon.

If you really don't want to wait for it, though, you can install v1.12.0.pre.2 via gem install bundler --pre

@emirkin
Copy link

emirkin commented Mar 14, 2016

@RochesterinNYC Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants