Skip to content

Commit 890015a

Browse files
committed
Avoid uninitialized variable warnings on Ruby 2.7
Since the variable is either set to true, or not present at all we can check wether it's defined instead.
1 parent 9ec453d commit 890015a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activesupport/lib/active_support/error_reporter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def set_context(...)
166166
# Rails.error.report(error)
167167
#
168168
def report(error, handled: true, severity: handled ? :warning : :error, context: {}, source: DEFAULT_SOURCE)
169-
return if error.instance_variable_get(:@__rails_error_reported)
169+
return if error.instance_variable_defined?(:@__rails_error_reported)
170170

171171
unless SEVERITIES.include?(severity)
172172
raise ArgumentError, "severity must be one of #{SEVERITIES.map(&:inspect).join(", ")}, got: #{severity.inspect}"

0 commit comments

Comments
 (0)