Sha256: 69be19b80279e586eedeffad569c7be4c5c5af1e3512d3850876071cf18bfe22

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 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) && exception.bugsnag_user_id.is_a?(String)
          report.user = {id: exception.bugsnag_user_id}
        end

        if exception.respond_to?(:bugsnag_context) && exception.bugsnag_context.is_a?(String)
          report.context = exception.bugsnag_context
        end

        if exception.respond_to?(:bugsnag_grouping_hash) && exception.bugsnag_grouping_hash.is_a?(String)
          report.grouping_hash = exception.bugsnag_grouping_hash
        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
          end
        end
      end

      @bugsnag.call(report)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bugsnag-6.13.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.12.2 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.12.1 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.12.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.11.1 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.11.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.10.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.9.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.8.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.7.3 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.7.2 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.7.1 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.7.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.6.4 lib/bugsnag/middleware/exception_meta_data.rb