From c49dc6803b1d52ff228e8cc10ce8350d37f41b17 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Fri, 17 Sep 2021 00:06:42 +0100 Subject: [PATCH] exceptions: set backtrace for FormulaUnreadableError --- Library/Homebrew/exceptions.rb | 2 ++ Library/Homebrew/test/cli/named_args_spec.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 99745cdb8b..02928cf3fd 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -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 diff --git a/Library/Homebrew/test/cli/named_args_spec.rb b/Library/Homebrew/test/cli/named_args_spec.rb index 0f734816a7..06e85a7344 100644 --- a/Library/Homebrew/test/cli/named_args_spec.rb +++ b/Library/Homebrew/test/cli/named_args_spec.rb @@ -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