aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler.rb
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-07-14 22:00:09 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-07-20 09:35:41 -0500
commit85f7252bc4e57c1d85e5fb1c2a808b90e209bb2b (patch)
treeb1cd66888db41b92f519f0734a62b644106129aa /lib/bundler.rb
parent396c9a5d6da3835ce21cccaadd5ae4fb0e781dba (diff)
downloadbundler-85f7252bc4e57c1d85e5fb1c2a808b90e209bb2b.tar.gz
[Bundler] Use DSLError when eval-ing a gemspec fails
Diffstat (limited to 'lib/bundler.rb')
-rw-r--r--lib/bundler.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 07064dad..bedc0464 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -401,17 +401,13 @@ module Bundler
def eval_gemspec(path, contents)
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
rescue ScriptError, StandardError => e
- original_line = e.backtrace.find {|line| line.include?(path.to_s) }
- msg = String.new
- msg << "There was a #{e.class} while loading #{path.basename}: \n#{e.message}"
- msg << " from\n #{original_line}" if original_line
- msg << "\n"
+ msg = "There was an error while loading `#{path.basename}`: #{e.message}"
if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
- msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
+ msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
end
- raise GemspecError, msg
+ raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
end
def configure_gem_home_and_path