Remove InstallationError superclass
None of these subclasses share any behavior other than what is inherited from RuntimeError, so we can just get rid of the superclass.
This commit is contained in:
parent
909c2bd59e
commit
081036c81c
@ -79,46 +79,33 @@ class OperationInProgressError < RuntimeError
|
||||
end
|
||||
end
|
||||
|
||||
module Homebrew
|
||||
class InstallationError < RuntimeError
|
||||
attr_reader :formula
|
||||
|
||||
def initialize(formula, message)
|
||||
super message
|
||||
@formula = formula
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class CannotInstallFormulaError < RuntimeError; end
|
||||
|
||||
class FormulaAlreadyInstalledError < RuntimeError; end
|
||||
|
||||
class FormulaInstallationAlreadyAttemptedError < Homebrew::InstallationError
|
||||
class FormulaInstallationAlreadyAttemptedError < RuntimeError
|
||||
def initialize(formula)
|
||||
super formula, "Formula installation already attempted: #{formula}"
|
||||
super "Formula installation already attempted: #{formula}"
|
||||
end
|
||||
end
|
||||
|
||||
class UnsatisfiedRequirements < Homebrew::InstallationError
|
||||
attr_reader :reqs
|
||||
|
||||
def initialize formula, reqs
|
||||
@reqs = reqs
|
||||
message = (reqs.length == 1) \
|
||||
? "An unsatisfied requirement failed this build." \
|
||||
: "Unsatisifed requirements failed this build."
|
||||
super formula, message
|
||||
class UnsatisfiedRequirements < RuntimeError
|
||||
def initialize(reqs)
|
||||
if reqs.length == 1
|
||||
super "An unsatisfied requirement failed this build."
|
||||
else
|
||||
super "Unsatisified requirements failed this build."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class FormulaConflictError < Homebrew::InstallationError
|
||||
attr_reader :conflicts
|
||||
class FormulaConflictError < RuntimeError
|
||||
attr_reader :formula, :conflicts
|
||||
|
||||
def initialize(formula, conflicts)
|
||||
@conflicts = conflicts
|
||||
@formula = formula
|
||||
super formula, message
|
||||
@conflicts = conflicts
|
||||
super message
|
||||
end
|
||||
|
||||
def conflict_message(conflict)
|
||||
@ -144,13 +131,14 @@ class FormulaConflictError < Homebrew::InstallationError
|
||||
end
|
||||
end
|
||||
|
||||
class BuildError < Homebrew::InstallationError
|
||||
attr_reader :env
|
||||
class BuildError < RuntimeError
|
||||
attr_reader :formula, :env
|
||||
|
||||
def initialize(formula, cmd, args, env)
|
||||
@formula = formula
|
||||
@env = env
|
||||
args = args.map{ |arg| arg.to_s.gsub " ", "\\ " }.join(" ")
|
||||
super formula, "Failed executing: #{cmd} #{args}"
|
||||
super "Failed executing: #{cmd} #{args}"
|
||||
end
|
||||
|
||||
def issues
|
||||
@ -202,9 +190,9 @@ end
|
||||
|
||||
# raised by CompilerSelector if the formula fails with all of
|
||||
# the compilers available on the user's system
|
||||
class CompilerSelectionError < Homebrew::InstallationError
|
||||
def initialize formula
|
||||
super formula, <<-EOS.undent
|
||||
class CompilerSelectionError < RuntimeError
|
||||
def initialize(formula)
|
||||
super <<-EOS.undent
|
||||
#{formula.name} cannot be built with any available compilers.
|
||||
To install this formula, you may need to:
|
||||
brew install gcc
|
||||
|
@ -232,7 +232,7 @@ class FormulaInstaller
|
||||
end
|
||||
end
|
||||
|
||||
raise UnsatisfiedRequirements.new(f, fatals) unless fatals.empty?
|
||||
raise UnsatisfiedRequirements.new(fatals) unless fatals.empty?
|
||||
end
|
||||
|
||||
def install_requirement_default_formula?(req, build)
|
||||
|
Loading…
x
Reference in New Issue
Block a user