exceptions: set backtrace for FormulaUnreadableError

This commit is contained in:
Bo Anderson 2021-09-17 00:06:42 +01:00
parent e011b15953
commit c49dc6803b
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
2 changed files with 3 additions and 1 deletions

View File

@ -208,6 +208,7 @@ class FormulaUnreadableError < FormulaUnavailableError
def initialize(name, error)
super(name)
@formula_error = error
set_backtrace(error.backtrace)
end
end
@ -257,6 +258,7 @@ class TapFormulaUnreadableError < TapFormulaUnavailableError
def initialize(tap, name, error)
super(tap, name)
@formula_error = error
set_backtrace(error.backtrace)
end
end

View File

@ -4,7 +4,7 @@
require "cli/named_args"
def setup_unredable_formula(name)
error = FormulaUnreadableError.new(name, "testing")
error = FormulaUnreadableError.new(name, RuntimeError.new("testing"))
allow(Formulary).to receive(:factory).with(name, force_bottle: false, flags: []).and_raise(error)
end