diff options
author | Agis- <corestudiosinc@gmail.com> | 2015-08-28 23:39:13 +0300 |
---|---|---|
committer | Agis- <corestudiosinc@gmail.com> | 2015-08-29 11:54:39 +0300 |
commit | f668e28c19886ffa4680c4ac58e6bf58a3ebccde (patch) | |
tree | 509fc5a7d2f9eb5372cee01a95965a9aea03d1fb /lib/bundler/runtime.rb | |
parent | fa9c4e2343ebeaaa4e0eb62c41327eba37cca9ee (diff) | |
download | bundler-f668e28c19886ffa4680c4ac58e6bf58a3ebccde.tar.gz |
Handle errors when requiring gems gracefully
Fixes #3960.
Diffstat (limited to 'lib/bundler/runtime.rb')
-rw-r--r-- | lib/bundler/runtime.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 5f340a3e64..5e87ee7cc3 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -73,7 +73,13 @@ module Bundler # Allow `require: true` as an alias for `require: <name>` file = dep.name if file == true required_file = file - Kernel.require file + begin + Kernel.require file + rescue => e + raise e if e.is_a?(LoadError) # we handle this a little later + raise Bundler::GemRequireError.new e, + "There was an error while trying to load the gem '#{file}'." + end end rescue LoadError => e REQUIRE_ERRORS.find {|r| r =~ e.message } |