Sha256: df2c5d132c3ba727a9395b93823595976d8bfe3407fb67b30aab0386a32c209a

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 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
          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

10 entries across 10 versions & 1 rubygems

Version Path
bugsnag-6.22.1 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.21.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.20.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.19.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.18.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.17.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.16.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.15.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.14.0 lib/bugsnag/middleware/exception_meta_data.rb
bugsnag-6.13.1 lib/bugsnag/middleware/exception_meta_data.rb