Sha256: eedb82f4078ff7a6023d88849b35f4694a4bb4bf46c9192d930daf999851d55c

Contents?: true

Size: 716 Bytes

Versions: 25

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

module ElasticAPM
  class Error
    # @api private
    class Exception
      MOD_SPLIT = '::'.freeze

      def initialize(exception, **attrs)
        @message =
          "#{exception.class}: #{exception.message}"
        @type = exception.class.to_s
        @module = format_module exception

        attrs.each do |key, val|
          send(:"#{key}=", val)
        end
      end

      attr_accessor(
        :attributes,
        :code,
        :handled,
        :message,
        :module,
        :stacktrace,
        :type
      )

      private

      def format_module(exception)
        exception.class.to_s.split(MOD_SPLIT)[0...-1].join(MOD_SPLIT)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
elastic-apm-1.1.0 lib/elastic_apm/error/exception.rb
elastic-apm-1.0.2 lib/elastic_apm/error/exception.rb
elastic-apm-1.0.1 lib/elastic_apm/error/exception.rb
elastic-apm-1.0.0 lib/elastic_apm/error/exception.rb
elastic-apm-1.0.0.beta2 lib/elastic_apm/error/exception.rb
elastic-apm-1.0.0.beta1 lib/elastic_apm/error/exception.rb
elastic-apm-0.8.0 lib/elastic_apm/error/exception.rb
elastic-apm-0.7.4 lib/elastic_apm/error/exception.rb
elastic-apm-0.7.3 lib/elastic_apm/error/exception.rb
elastic-apm-0.7.2 lib/elastic_apm/error/exception.rb
elastic-apm-0.7.1 lib/elastic_apm/error/exception.rb
elastic-apm-0.7.0 lib/elastic_apm/error/exception.rb
elastic-apm-0.6.2 lib/elastic_apm/error/exception.rb
elastic-apm-0.6.1 lib/elastic_apm/error/exception.rb
elastic-apm-0.5.1 lib/elastic_apm/error/exception.rb
elastic-apm-0.5.0 lib/elastic_apm/error/exception.rb
elastic-apm-0.4.5 lib/elastic_apm/error/exception.rb
elastic-apm-0.4.4 lib/elastic_apm/error/exception.rb
elastic-apm-0.4.3 lib/elastic_apm/error/exception.rb
elastic-apm-0.4.2 lib/elastic_apm/error/exception.rb