Preserve backtrace from original exception

This commit is contained in:
Jack Nagel 2014-12-29 15:23:01 -05:00
parent 633f29af5d
commit a955665102
2 changed files with 7 additions and 8 deletions

View File

@ -119,7 +119,7 @@ module Superenv
when "gcc-4.2" when "gcc-4.2"
begin begin
apple_gcc42 = Formulary.factory('apple-gcc42') apple_gcc42 = Formulary.factory('apple-gcc42')
rescue Exception # in --debug, catch bare exceptions too rescue FormulaUnavailableError
end end
paths << apple_gcc42.opt_bin.to_s if apple_gcc42 paths << apple_gcc42.opt_bin.to_s if apple_gcc42
when GNU_GCC_REGEXP when GNU_GCC_REGEXP

View File

@ -55,8 +55,8 @@ class Formulary
def klass def klass
begin begin
have_klass = Formulary.formula_class_defined? class_name have_klass = Formulary.formula_class_defined? class_name
rescue NameError rescue NameError => e
raise FormulaUnavailableError.new(name) raise FormulaUnavailableError, name, e.backtrace
end end
load_file unless have_klass load_file unless have_klass
@ -78,9 +78,8 @@ class Formulary
# This is a programming error in an existing formula, and should not # This is a programming error in an existing formula, and should not
# have a "no such formula" message. # have a "no such formula" message.
raise raise
rescue LoadError, NameError rescue LoadError, NameError => e
raise if ARGV.debug? # let's see the REAL error raise FormulaUnavailableError, name, e.backtrace
raise FormulaUnavailableError.new(name)
end end
end end
end end
@ -174,8 +173,8 @@ class Formulary
def get_formula(spec) def get_formula(spec)
super super
rescue FormulaUnavailableError rescue FormulaUnavailableError => e
raise TapFormulaUnavailableError.new(tapped_name) raise TapFormulaUnavailableError, tapped_name, e.backtrace
end end
end end