aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/exceptions.rb
diff options
context:
space:
mode:
authorJack Nagel2014-09-14 01:10:20 -0500
committerJack Nagel2014-09-14 01:10:20 -0500
commita2da10153a24cdc513eb26b82fb48e83f9f5edc6 (patch)
treec12af1209154c14988817620203cfcca8a657f77 /Library/Homebrew/exceptions.rb
parenta8d49d1181a3cf7153f882e01bb42117a64af210 (diff)
downloadhomebrew-a2da10153a24cdc513eb26b82fb48e83f9f5edc6.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
-rw-r--r--Library/Homebrew/exceptions.rb60
1 files changed, 24 insertions, 36 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index d104b23dd..7afb0db0e 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -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,13 +190,13 @@ 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
- #{formula.name} cannot be built with any available compilers.
- To install this formula, you may need to:
- brew install gcc
- EOS
+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
+ EOS
end
end