Sha256: 25a402c764f7a176dfd53ede3bdb76ad674897f9164279d9501f86a472c697ba
Contents?: true
Size: 1.24 KB
Versions: 13
Compression:
Stored size: 1.24 KB
Contents
module Bugsnag::Middleware ## # Extracts data from the exception. class ExceptionMetaData def initialize(bugsnag) @bugsnag = bugsnag 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) user_id = exception.bugsnag_user_id report.user = {id: user_id} if user_id.is_a?(String) end if exception.respond_to?(:bugsnag_context) context = exception.bugsnag_context # note: this should set 'context' not 'automatic_context' as it's a # user-supplied value report.context = context if context.is_a?(String) end 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) 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) end end end
Version data entries
13 entries across 13 versions & 1 rubygems