Skip to content

Commit

Permalink
Fix Lorekeeper::BacktraceCleaner#clean to not raise when a non-array …
Browse files Browse the repository at this point in the history
…value is passed (#38)
  • Loading branch information
ykitamura-mdsol authored May 9, 2023
1 parent dd17b32 commit 4702c93
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2.6.1
* Fix Lorekeeper::BacktraceCleaner#clean to not raise when a non-array value is passed

# 2.6.0
* Expose Lorekeeper::BacktraceCleaner

Expand Down
2 changes: 2 additions & 0 deletions lib/lorekeeper/backtrace_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def initialize
end

def clean(backtrace)
return [] unless backtrace.is_a?(Array)

backtrace = filter_rails_root_backtrace(backtrace)
@backtrace_cleaner&.clean(backtrace) || backtrace
end
Expand Down
2 changes: 1 addition & 1 deletion lib/lorekeeper/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Lorekeeper
VERSION = '2.6.0'
VERSION = '2.6.1'
end
4 changes: 4 additions & 0 deletions spec/lib/lorekeeper/backtrace_cleaner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
])
end

it 'returns an empty array when nil is passed' do
expect(instance.clean(nil)).to eq([])
end

context 'with LOREKEEPER_DENYLIST env var' do
before do
allow(ENV).to receive(:key?).with('LOREKEEPER_DENYLIST').and_return(true)
Expand Down

0 comments on commit 4702c93

Please sign in to comment.