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

Commit

Permalink
raising Gem::InstallError is the worst possible thing
Browse files Browse the repository at this point in the history
This code meant that _any_ gem install failure resulted in a message requesting the user to report this "bug" to the Bundler issue tracker. That is very, very not cool, and I had already fixed this issue once before the hook pull request regressed it. :(
  • Loading branch information
indirect committed Mar 11, 2012
1 parent abdc637 commit 1f2cd74
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class GemfileNotFound < BundlerError; status_code(10) ; end
class GemNotFound < BundlerError; status_code(7) ; end
class GemfileError < BundlerError; status_code(4) ; end
class InstallError < BundlerError; status_code(5) ; end
class InstallHookError < BundlerError; status_code(6) ; end
class PathError < BundlerError; status_code(13) ; end
class GitError < BundlerError; status_code(11) ; end
class DeprecatedError < BundlerError; status_code(12) ; end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def install_gem_from_spec(spec, standalone = false)
FileUtils.rm_rf(Bundler.tmp)
rescue Exception => e
# install hook failed
raise e if e.is_a?(Gem::InstallError)
raise e if e.is_a?(Bundler::InstallHookError)

# other failure, likely a native extension build failure
Bundler.ui.info ""
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def run_hooks(type, installer)
if result == false
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
message = "#{type} hook#{location} failed for #{installer.spec.full_name}"
raise Gem::InstallError, message
raise InstallHookError, message
end
end
end
Expand Down

0 comments on commit 1f2cd74

Please sign in to comment.