2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/eco/api/common/version_patches/exception.rb', line 2
def patch_full_message(trace_count: -1, cause_levels: 3)
return unless cause_levels.positive?
cause_levels -= 1
trace_count = 3 if trace_count.negative? || trace_count > 3
tracing = backtrace || []
first_ln = tracing[0]
tracing = tracing[1..trace_count]
tracing = tracing[1..30] if instance_of?(SystemStackError)
tracing ||= []
msg = []
msg << "\n#{first_ln} \n#{message} (#{self.class})"
tracing.each_with_index do |bt, i|
msg << "#{" " * 8}#{i + 1}: from #{bt}"
end
unless cause.nil?
msg << "\nCAUSE:"
msg << cause.patch_full_message(
trace_count: trace_count,
cause_levels: cause_levels
)
end
msg.join("\n")
rescue StandardError => e
puts "Something is wrong with 'patch_full_message': #{e}"
end
|