Class: Sentry::SingleExceptionInterface
- Defined in:
- lib/sentry/interfaces/single_exception.rb
Instance Attribute Summary collapse
-
#module ⇒ Object
readonly
Returns the value of attribute module.
-
#stacktrace ⇒ Object
readonly
Returns the value of attribute stacktrace.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.build_with_stacktrace(exception:, stacktrace_builder:) ⇒ Object
patch this method if you want to change an exception’s stacktrace frames also see
StacktraceBuilder.build.
Instance Method Summary collapse
-
#initialize(exception:, stacktrace: nil) ⇒ SingleExceptionInterface
constructor
A new instance of SingleExceptionInterface.
- #to_hash ⇒ Object
Methods inherited from Interface
Constructor Details
#initialize(exception:, stacktrace: nil) ⇒ SingleExceptionInterface
5 6 7 8 9 10 11 |
# File 'lib/sentry/interfaces/single_exception.rb', line 5 def initialize(exception:, stacktrace: nil) @type = exception.class.to_s @value = (exception. || "").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 end |
Instance Attribute Details
#module ⇒ Object (readonly)
Returns the value of attribute module.
3 4 5 |
# File 'lib/sentry/interfaces/single_exception.rb', line 3 def module @module end |
#stacktrace ⇒ Object (readonly)
Returns the value of attribute stacktrace.
3 4 5 |
# File 'lib/sentry/interfaces/single_exception.rb', line 3 def stacktrace @stacktrace end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
3 4 5 |
# File 'lib/sentry/interfaces/single_exception.rb', line 3 def thread_id @thread_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/sentry/interfaces/single_exception.rb', line 3 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/sentry/interfaces/single_exception.rb', line 3 def value @value end |
Class Method Details
.build_with_stacktrace(exception:, stacktrace_builder:) ⇒ Object
patch this method if you want to change an exception’s stacktrace frames also see StacktraceBuilder.build.
21 22 23 24 |
# File 'lib/sentry/interfaces/single_exception.rb', line 21 def self.build_with_stacktrace(exception:, stacktrace_builder:) stacktrace = stacktrace_builder.build(backtrace: exception.backtrace) new(exception: exception, stacktrace: stacktrace) end |
Instance Method Details
#to_hash ⇒ Object
13 14 15 16 17 |
# File 'lib/sentry/interfaces/single_exception.rb', line 13 def to_hash data = super data[:stacktrace] = data[:stacktrace].to_hash if data[:stacktrace] data end |