Method: Sentry::SingleExceptionInterface.build_with_stacktrace
- Defined in:
- lib/sentry/interfaces/single_exception.rb
.build_with_stacktrace(exception:, stacktrace_builder:, mechanism:) ⇒ Object
patch this method if you want to change an exception’s stacktrace frames also see ‘StacktraceBuilder.build`.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/sentry/interfaces/single_exception.rb', line 44 def self.build_with_stacktrace(exception:, stacktrace_builder:, mechanism:) stacktrace = stacktrace_builder.build(backtrace: exception.backtrace) if locals = exception.instance_variable_get(:@sentry_locals) locals.each do |k, v| locals[k] = begin v = v.inspect unless v.is_a?(String) if v.length >= MAX_LOCAL_BYTES v = v.byteslice(0..MAX_LOCAL_BYTES - 1) + OMISSION_MARK end Utils::EncodingHelper.encode_to_utf_8(v) rescue StandardError PROBLEMATIC_LOCAL_VALUE_REPLACEMENT end end stacktrace.frames.last.vars = locals end new(exception: exception, stacktrace: stacktrace, mechanism: mechanism) end |