Created
January 7, 2021 11:15
-
-
Save arathunku/363dbcaf9357b4f31bfb82b5f8aea902 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveSupport.on_load(:action_controller_base) do | |
bc = ActiveSupport::BacktraceCleaner.new | |
bc.remove_silencers! | |
bc.add_silencer { |line| line.start_with?(RbConfig::CONFIG["rubylibdir"]) } | |
bc.add_silencer { |line| line =~ Regexp.union( | |
*( | |
%w{ bootsnap railties spring activesupport actionpack zeitwerk thor rack }. | |
map{|g| /\A#{g} \([\w.]+\) /} | |
), | |
/\Abin\/rails/ | |
)} | |
trace = bc.clean(caller) | |
puts "Cleaned backtrace:\n\t#{trace.join("\n\t")}\n" | |
puts "Most probably the cause is: #{trace.first}" | |
puts "If not - uncomment `raise` at #{__FILE__}:#{__LINE__+1}" | |
# raise "i can haz full backtrace" | |
exit(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment