lib/bugsnag/middleware/exception_meta_data.rb in bugsnag-6.13.0 vs lib/bugsnag/middleware/exception_meta_data.rb in bugsnag-6.13.1
- old
+ new
@@ -7,24 +7,30 @@
end
def call(report)
# Apply the user's information attached to the exceptions
report.raw_exceptions.each do |exception|
- if exception.respond_to?(:bugsnag_user_id) && exception.bugsnag_user_id.is_a?(String)
- report.user = {id: exception.bugsnag_user_id}
+ if exception.respond_to?(:bugsnag_user_id)
+ user_id = exception.bugsnag_user_id
+ report.user = {id: user_id} if user_id.is_a?(String)
end
- if exception.respond_to?(:bugsnag_context) && exception.bugsnag_context.is_a?(String)
- report.context = exception.bugsnag_context
+ if exception.respond_to?(:bugsnag_context)
+ context = exception.bugsnag_context
+ report.context = context if context.is_a?(String)
end
- if exception.respond_to?(:bugsnag_grouping_hash) && exception.bugsnag_grouping_hash.is_a?(String)
- report.grouping_hash = exception.bugsnag_grouping_hash
+ if exception.respond_to?(:bugsnag_grouping_hash)
+ group_hash = exception.bugsnag_grouping_hash
+ report.grouping_hash = group_hash if group_hash.is_a?(String)
end
- if exception.respond_to?(:bugsnag_meta_data) && exception.bugsnag_meta_data.is_a?(Hash)
- exception.bugsnag_meta_data.each do |key, value|
- report.add_tab key, value
+ if exception.respond_to?(:bugsnag_meta_data)
+ meta_data = exception.bugsnag_meta_data
+ if meta_data.is_a?(Hash)
+ meta_data.each do |key, value|
+ report.add_tab key, value
+ end
end
end
end
@bugsnag.call(report)