aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-12-29 15:23:01 -0500
committerJack Nagel2014-12-29 15:23:01 -0500
commit820fb42d9b4b787e5ba1729ed7ac8bb189d955de (patch)
tree44e13040969ee94c3ab84f4ed54f82755bac2f0a
parentd48f73b94072715c10fe194ee1f443827c8d1b7f (diff)
downloadhomebrew-820fb42d9b4b787e5ba1729ed7ac8bb189d955de.tar.bz2
Preserve backtrace from original exception
-rw-r--r--Library/Homebrew/extend/ENV/super.rb2
-rw-r--r--Library/Homebrew/formulary.rb13
2 files changed, 7 insertions, 8 deletions
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index cb3c12b33..a23fd7d4e 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -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
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 65a790639..2af67644f 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -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