Skip to content

Commit

Permalink
Handle error conservatively
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli committed Feb 12, 2023
1 parent 24df38d commit e9f5d3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/jekyll/filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,12 @@ def read_liquid_attribute(liquid_data, property)
property.split(".").reduce(liquid_data) do |data, key|
data.respond_to?(:[]) && data[key]
end
rescue StandardError => e
rescue TypeError => e
msg = if liquid_data.is_a?(Array)
"Error accessing object (#{liquid_data}) with given key. Expected an integer but " \
"got #{property.inspect} instead"
else
e.message
end
raise e, msg
end
Expand Down

0 comments on commit e9f5d3f

Please sign in to comment.