Improve rescue nesting.

This commit is contained in:
Mike McQuaid 2016-09-17 17:01:04 +01:00
parent 69e4ad9809
commit 1bdbb0f462
4 changed files with 20 additions and 20 deletions

View File

@ -516,10 +516,10 @@ module Homebrew
# Our gettext formula will be caught by check_linked_keg_only_brews
gettext = begin
Formulary.factory("gettext")
rescue
nil
end
Formulary.factory("gettext")
rescue
nil
end
homebrew_owned = @found.all? do |path|
Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
end
@ -537,10 +537,10 @@ module Homebrew
return if @found.empty?
libiconv = begin
Formulary.factory("libiconv")
rescue
nil
end
Formulary.factory("libiconv")
rescue
nil
end
if libiconv && libiconv.linked_keg.directory?
unless libiconv.keg_only?
<<-EOS.undent

View File

@ -269,10 +269,10 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
case entries.length
when 0 then raise "Empty archive"
when 1 then begin
Dir.chdir entries.first
rescue
nil
end
Dir.chdir entries.first
rescue
nil
end
end
end

View File

@ -56,10 +56,10 @@ require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"
ORIGINAL_PATHS = ENV["PATH"].split(File::PATH_SEPARATOR).map do |p|
begin
Pathname.new(p).expand_path
rescue
nil
end
Pathname.new(p).expand_path
rescue
nil
end
end.compact.freeze
# TODO: remove this as soon as it's removed from commands.rb.

View File

@ -339,10 +339,10 @@ class BottleSpecification
os_versions = collector.keys
os_versions.map! do |osx|
begin
MacOS::Version.from_symbol osx
rescue
nil
end
MacOS::Version.from_symbol osx
rescue
nil
end
end.compact!
os_versions.sort.reverse_each do |os_version|
osx = os_version.to_sym