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"
begin
apple_gcc42 = Formulary.factory('apple-gcc42')
rescue Exception # in --debug, catch bare exceptions too
rescue FormulaUnavailableError
end
paths << apple_gcc42.opt_bin.to_s if apple_gcc42
when GNU_GCC_REGEXP

View File

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