class Sentry::ExceptionInterface

Public Class Methods

build(exception:, stacktrace_builder:) click to toggle source
# File lib/sentry/interfaces/exception.rb, line 13
def self.build(exception:, stacktrace_builder:)
  exceptions = Sentry::Utils::ExceptionCauseChain.exception_to_array(exception).reverse
  processed_backtrace_ids = Set.new

  exceptions = exceptions.map do |e|
    if e.backtrace && !processed_backtrace_ids.include?(e.backtrace.object_id)
      processed_backtrace_ids << e.backtrace.object_id
      SingleExceptionInterface.build_with_stacktrace(exception: e, stacktrace_builder: stacktrace_builder)
    else
      SingleExceptionInterface.new(exception: exception)
    end
  end

  new(values: exceptions)
end
new(values:) click to toggle source
# File lib/sentry/interfaces/exception.rb, line 3
def initialize(values:)
  @values = values
end

Public Instance Methods

to_hash() click to toggle source
Calls superclass method Sentry::Interface#to_hash
# File lib/sentry/interfaces/exception.rb, line 7
def to_hash
  data = super
  data[:values] = data[:values].map(&:to_hash) if data[:values]
  data
end