Skip to content

Commit

Permalink
Log backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
swebb committed Jul 29, 2022
1 parent 0cdec78 commit 538d26a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/buildkite/test_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def self.safe(&block)
block.call
rescue StandardError => e
logger.error("Buildkite::TestCollector received exception: #{e}")
logger.error("Backtrace:\n#{e.backtrace.join("\n")}")
end
end
end
2 changes: 1 addition & 1 deletion spec/test_collector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def error(message)

it "suppresses exceptions and logs them to logger.error" do
expect{ described_class.safe { raise "penguines dance" } }.to_not raise_error
expect(logger.errors).to eq(["Buildkite::TestCollector received exception: penguines dance"])
expect(logger.errors.first).to eq("Buildkite::TestCollector received exception: penguines dance")
end
end
end

0 comments on commit 538d26a

Please sign in to comment.