Sha256: 335e7b8d5a33246a74c6dee44549bd1187f82797eca08869489e0b85c06da91e

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

require 'rollbar/exception_reporter'
require 'rollbar/request_data_extractor'

module Pliny
  module ErrorReporters
    class Rollbar
      include ::Rollbar::ExceptionReporter
      include ::Rollbar::RequestDataExtractor

      def notify(exception, context:, rack_env:)
        ::Rollbar.reset_notifier!
        scope = fetch_scope(context: context, rack_env: rack_env)
        ::Rollbar.scoped(scope) do
          report_exception_to_rollbar(rack_env, exception)
        end
      end

      private

      def fetch_scope(context:, rack_env:)
        scope = { custom: context }
        unless rack_env.empty?
          scope[:request] = proc { extract_request_data_from_rack(rack_env) }
        end
        scope
      rescue Exception => e
        report_exception_to_rollbar(rack_env, e)
        raise
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pliny-0.26.1 lib/pliny/error_reporters/rollbar.rb
pliny-0.26.0 lib/pliny/error_reporters/rollbar.rb
pliny-0.25.1 lib/pliny/error_reporters/rollbar.rb
pliny-0.25.0 lib/pliny/error_reporters/rollbar.rb