summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorutilum <oz@utilum.com>2018-02-25 22:55:41 +0100
committerSamuel Giddins <segiddins@segiddins.me>2018-03-17 10:53:34 -0700
commit1e3c630d3f968c9b4c9b8996b940be4694d58544 (patch)
tree96a5add08473429feb61ba46441aa1dc88fcba58
parent7f4c1a81b7b92e234fce0e3592d27c396d2451ac (diff)
downloadbundler-1e3c630d3f968c9b4c9b8996b940be4694d58544.tar.gz
Fix some rescue calls that do not specifiy error type.
-rw-r--r--lib/bundler.rb4
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/endpoint_specification.rb2
-rw-r--r--lib/bundler/env.rb2
-rw-r--r--lib/bundler/fetcher.rb2
-rw-r--r--lib/bundler/gem_helper.rb2
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--lib/bundler/installer/gem_installer.rb2
-rw-r--r--lib/bundler/installer/parallel_installer.rb2
-rw-r--r--lib/bundler/mirror.rb4
-rw-r--r--lib/bundler/plugin.rb4
-rw-r--r--lib/bundler/plugin/index.rb2
-rw-r--r--lib/bundler/runtime.rb2
-rw-r--r--task/release.rake2
14 files changed, 17 insertions, 17 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 8fc8da6dcb..9056c1aa42 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -189,7 +189,7 @@ module Bundler
end
tmp_home_path.join(login).tap(&:mkpath)
end
- rescue => e
+ rescue RuntimeError => e
raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
end
@@ -426,7 +426,7 @@ EOF
def load_marshal(data)
Marshal.load(data)
- rescue => e
+ rescue StandardError => e
raise MarshalError, "#{e.class}: #{e.message}"
end
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 33796ea9a6..d86441f5ae 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -745,7 +745,7 @@ module Bundler
end
Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
- rescue
+ rescue RuntimeError
nil
end
end
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb
index 8668c4ea7f..9a00b64e0e 100644
--- a/lib/bundler/endpoint_specification.rb
+++ b/lib/bundler/endpoint_specification.rb
@@ -123,7 +123,7 @@ module Bundler
@required_ruby_version = Gem::Requirement.new(v)
end
end
- rescue => e
+ rescue StandardError => e
raise GemspecError, "There was an error parsing the metadata for the gem #{name} (#{version}): #{e.class}\n#{e}\nThe metadata was #{data.inspect}"
end
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb
index 58fe20dbe7..b91a345cee 100644
--- a/lib/bundler/env.rb
+++ b/lib/bundler/env.rb
@@ -64,7 +64,7 @@ module Bundler
File.read(filename.to_s).strip
rescue Errno::ENOENT
"<No #{filename} found>"
- rescue => e
+ rescue RuntimeError => e
"#{e.class}: #{e.message}"
end
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 444778b36b..4dd42e42ff 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -178,7 +178,7 @@ module Bundler
# engine_version raises on unknown engines
engine_version = begin
ruby.engine_versions
- rescue
+ rescue RuntimeError
"???"
end
agent << " #{ruby.engine}/#{ruby.versions_string(engine_version)}"
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 3458a2adda..ba996d8a85 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -160,7 +160,7 @@ module Bundler
sh %W[git tag -m Version\ #{version} #{version_tag}]
Bundler.ui.confirm "Tagged #{version_tag}."
yield if block_given?
- rescue
+ rescue RuntimeError
Bundler.ui.error "Untagging #{version_tag} due to error."
sh_with_status %W[git tag -d #{version_tag}]
raise
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 1b9fef1e39..58241367f2 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -220,7 +220,7 @@ module Bundler
def processor_count
require "etc"
Etc.nprocessors
- rescue
+ rescue Runtimeerror
1
end
diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb
index a38f8d95be..d60d636949 100644
--- a/lib/bundler/installer/gem_installer.rb
+++ b/lib/bundler/installer/gem_installer.rb
@@ -21,7 +21,7 @@ module Bundler
raise
rescue Errno::ENOSPC
return false, out_of_space_message
- rescue => e
+ rescue StandardError => e
return false, specific_failure_message(e)
end
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index e6e81fddff..61ee001538 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -161,7 +161,7 @@ module Bundler
)
success, message = begin
gem_installer.install_from_spec
- rescue => e
+ rescue RuntimeError => e
raise e, "#{e}\n\n#{require_tree_for_spec(spec_install.spec)}"
end
if success
diff --git a/lib/bundler/mirror.rb b/lib/bundler/mirror.rb
index a6fa070eb8..b15190e7e5 100644
--- a/lib/bundler/mirror.rb
+++ b/lib/bundler/mirror.rb
@@ -152,7 +152,7 @@ module Bundler
socket.connect_nonblock(address)
rescue Errno::EINPROGRESS
wait_for_writtable_socket(socket, address, timeout)
- rescue # Connection failed somehow, again
+ rescue RuntimeError # Connection failed somehow, again
false
end
end
@@ -172,7 +172,7 @@ module Bundler
socket.connect_nonblock(address)
rescue Errno::EISCONN
true
- rescue # Connection failed
+ rescue StandardError # Connection failed
false
end
end
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index f7e6093fa5..127f1f64c0 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -86,7 +86,7 @@ module Bundler
installed_specs = Installer.new.install_definition(definition)
save_plugins plugins, installed_specs, builder.inferred_plugins
- rescue => e
+ rescue RuntimeError => e
unless e.is_a?(GemfileError)
Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"
end
@@ -284,7 +284,7 @@ module Bundler
load path.join(PLUGIN_FILE_NAME)
@loaded_plugin_names << name
- rescue => e
+ rescue RuntimeError => e
Bundler.ui.error "Failed loading plugin #{name}: #{e.message}"
raise
end
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index f5c2baf431..cd7a5093b3 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -58,7 +58,7 @@ module Bundler
@plugin_paths[name] = path
@load_paths[name] = load_paths
save_index
- rescue
+ rescue StandardError
@commands = old_commands
raise
end
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index acaae3cedf..762e7b3ec6 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -79,7 +79,7 @@ module Bundler
required_file = file
begin
Kernel.require file
- rescue => e
+ rescue RuntimeError => 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}'."
diff --git a/task/release.rake b/task/release.rake
index abf7bb340a..e90eec0bef 100644
--- a/task/release.rake
+++ b/task/release.rake
@@ -34,7 +34,7 @@ namespace :release do
if response.code.to_i >= 400
raise "#{uri}\n#{response.inspect}\n#{begin
JSON.parse(response.body)
- rescue
+ rescue JSON::ParseError
response.body
end}"
end