Method: Sentry::SingleExceptionInterface#initialize

Defined in:
lib/sentry/interfaces/single_exception.rb

#initialize(exception:, mechanism:, stacktrace: nil) ⇒ SingleExceptionInterface

Returns a new instance of SingleExceptionInterface.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sentry/interfaces/single_exception.rb', line 17

def initialize(exception:, mechanism:, stacktrace: nil)
  @type = exception.class.to_s
  exception_message =
    if exception.respond_to?(:detailed_message)
      exception.detailed_message(highlight: false)
    else
      exception.message || ""
    end
  exception_message = exception_message.inspect unless exception_message.is_a?(String)

  @value = Utils::EncodingHelper.encode_to_utf_8(exception_message.byteslice(0..Event::MAX_MESSAGE_SIZE_IN_BYTES))

  @module = exception.class.to_s.split("::")[0...-1].join("::")
  @thread_id = Thread.current.object_id
  @stacktrace = stacktrace
  @mechanism = mechanism
end