Class: Sentry::ExceptionInterface
- Defined in:
- lib/sentry/interfaces/exception.rb
Instance Attribute Summary collapse
Class Method Summary collapse
-
.build(exception:, stacktrace_builder:, mechanism:) ⇒ ExceptionInterface
Builds ExceptionInterface with given exception and stacktrace_builder.
Instance Method Summary collapse
-
#initialize(exceptions:) ⇒ ExceptionInterface
constructor
A new instance of ExceptionInterface.
- #to_hash ⇒ Hash
Constructor Details
#initialize(exceptions:) ⇒ ExceptionInterface
Returns a new instance of ExceptionInterface.
11 12 13 |
# File 'lib/sentry/interfaces/exception.rb', line 11 def initialize(exceptions:) @values = exceptions end |
Instance Attribute Details
#values ⇒ <Array[SingleExceptionInterface]> (readonly)
8 9 10 |
# File 'lib/sentry/interfaces/exception.rb', line 8 def values @values end |
Class Method Details
.build(exception:, stacktrace_builder:, mechanism:) ⇒ ExceptionInterface
Builds ExceptionInterface with given exception and stacktrace_builder.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sentry/interfaces/exception.rb', line 29 def self.build(exception:, stacktrace_builder:, mechanism:) 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, mechanism: mechanism) else SingleExceptionInterface.new(exception: exception, mechanism: mechanism) end end new(exceptions: exceptions) end |
Instance Method Details
#to_hash ⇒ Hash
16 17 18 19 20 |
# File 'lib/sentry/interfaces/exception.rb', line 16 def to_hash data = super data[:values] = data[:values].map(&:to_hash) if data[:values] data end |