Skip to content

Commit

Permalink
Merge pull request #586 from stoivo/master
Browse files Browse the repository at this point in the history
Don't call extra tracking data twice
  • Loading branch information
imjoehaines committed Apr 30, 2020
2 parents ea395ca + 96a10cd commit f05d9ea
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/bugsnag/middleware/exception_meta_data.rb
Expand Up @@ -9,21 +9,27 @@ def initialize(bugsnag)
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
Expand Down

0 comments on commit f05d9ea

Please sign in to comment.