Skip to content

Instantly share code, notes, and snippets.

@badbabykosh
Forked from bendilley/trace.rb
Created July 10, 2021 18:44
Embed
What would you like to do?
Get a trace from a 'stack too deep' error in Rails
$enable_tracing = false
#$trace_out = File.open(Rails.root + 'trace.txt', 'w')
set_trace_func proc { |event, file, line, id, binding, classname|
if $enable_tracing && event == 'call'
#$trace_out.puts "#{file}:#{line} #{classname}##{id}"
raise "crash me" if caller_locations.length > 500
end
}
$enable_tracing = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment