Sha256: 2404cd9674dc3d9c908d62f3b961de6b4341467e127fac7e08350db2c94355ce
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module ElasticAPM class Error # @api private class Exception MOD_SPLIT = '::' def initialize(attrs = nil) return unless attrs attrs.each do |key, val| send(:"#{key}=", val) end end def self.from_exception(exception, **attrs) new({ message: exception.message.to_s, type: exception.class.to_s, module: format_module(exception), cause: exception.cause && Exception.from_exception(exception.cause) }.merge(attrs)) end attr_accessor( :attributes, :code, :handled, :message, :module, :stacktrace, :type, :cause ) def inspect '<ElasticAPM::Error::Exception' \ " type:#{type}" \ " message:#{message}" \ '>' end class << self private def format_module(exception) exception.class.to_s.split(MOD_SPLIT)[0...-1].join(MOD_SPLIT) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems