diff options
| -rw-r--r-- | Library/Homebrew/cxxstdlib.rb | 13 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 9 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Library/Homebrew/cxxstdlib.rb b/Library/Homebrew/cxxstdlib.rb index 859c1aabb..7c3beafc8 100644 --- a/Library/Homebrew/cxxstdlib.rb +++ b/Library/Homebrew/cxxstdlib.rb @@ -3,6 +3,15 @@ require "compilers" class CxxStdlib include CompilerConstants + class CompatibilityError < StandardError + def initialize(formula, dep, stdlib) + super <<-EOS.undent + #{formula.name} dependency #{dep.name} was built with a different C++ standard + library (#{stdlib.type_string} from #{stdlib.compiler}). This may cause problems at runtime. + EOS + end + end + def self.create(type, compiler) if type && ![:libstdcxx, :libcxx].include?(type) raise ArgumentError, "Invalid C++ stdlib type: #{type}" @@ -18,7 +27,7 @@ class CxxStdlib begin stdlib.check_dependencies(formula, deps) - rescue IncompatibleCxxStdlibs => e + rescue CompatibilityError => e opoo e.message end end @@ -51,7 +60,7 @@ class CxxStdlib dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib if !compatible_with? dep_stdlib - raise IncompatibleCxxStdlibs.new(formula, dep, dep_stdlib, self) + raise CompatibilityError.new(formula, dep, dep_stdlib) end end end diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index d0d83bc89..743f63b0f 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -112,15 +112,6 @@ class UnsatisfiedRequirements < Homebrew::InstallationError end end -class IncompatibleCxxStdlibs < Homebrew::InstallationError - def initialize(f, dep, wrong, right) - super f, <<-EOS.undent - #{f} dependency #{dep} was built with a different C++ standard - library (#{wrong.type_string} from #{wrong.compiler}). This could cause problems at runtime. - EOS - end -end - class FormulaConflictError < Homebrew::InstallationError attr_reader :f, :conflicts |
