Sha256: 67a9680489cf83af4cbe94fcbe17da52b1a061adbbb9b8bd3ade15e9a199463c

Contents?: true

Size: 1.06 KB

Versions: 24

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module Sentry
  module Integrable
    def register_integration(name:, version:)
      Sentry.register_integration(name, version)
      @integration_name = name
    end

    def integration_name
      @integration_name
    end

    def capture_exception(exception, **options, &block)
      options[:hint] ||= {}
      options[:hint][:integration] = integration_name

      # within an integration, we usually intercept uncaught exceptions so we set handled to false.
      options[:hint][:mechanism] ||= Sentry::Mechanism.new(type: integration_name, handled: false)

      Sentry.capture_exception(exception, **options, &block)
    end

    def capture_message(message, **options, &block)
      options[:hint] ||= {}
      options[:hint][:integration] = integration_name
      Sentry.capture_message(message, **options, &block)
    end

    def capture_check_in(slug, status, **options, &block)
      options[:hint] ||= {}
      options[:hint][:integration] = integration_name
      Sentry.capture_check_in(slug, status, **options, &block)
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
sentry-ruby-core-5.22.2 lib/sentry/integrable.rb
sentry-ruby-5.22.2 lib/sentry/integrable.rb
sentry-ruby-core-5.22.1 lib/sentry/integrable.rb
sentry-ruby-5.22.1 lib/sentry/integrable.rb
sentry-ruby-5.22.0 lib/sentry/integrable.rb
sentry-ruby-core-5.22.0 lib/sentry/integrable.rb
sentry-ruby-5.21.0 lib/sentry/integrable.rb
sentry-ruby-core-5.21.0 lib/sentry/integrable.rb
sentry-ruby-5.20.1 lib/sentry/integrable.rb
sentry-ruby-core-5.20.1 lib/sentry/integrable.rb
sentry-ruby-5.20.0 lib/sentry/integrable.rb
sentry-ruby-core-5.20.0 lib/sentry/integrable.rb
sentry-ruby-core-5.19.0 lib/sentry/integrable.rb
sentry-ruby-5.19.0 lib/sentry/integrable.rb
sentry-ruby-core-5.18.2 lib/sentry/integrable.rb
sentry-ruby-5.18.2 lib/sentry/integrable.rb
sentry-ruby-core-5.18.1 lib/sentry/integrable.rb
sentry-ruby-5.18.1 lib/sentry/integrable.rb
sentry-ruby-5.18.0 lib/sentry/integrable.rb
sentry-ruby-core-5.18.0 lib/sentry/integrable.rb