Rack::ShowStackDeck catches all exceptions raised from the app it wraps. It shows a useful backtrace with the sourcefile and clickable context, the whole Rack environment and the request data.
Be careful when you use this on public-facing sites as it could reveal information helpful to attackers.
Rack::ShowStackDeck is based on, and functionally very similar to, Rack::ShowExceptions – the key difference is that it uses the StackDeck library to show the full cross-language backtrace, where relevant.
# File lib/rack/show_stackdeck.rb, line 23 def initialize(app, options={}) @app = app @template = ERB.new(TEMPLATE) @exception_status = Hash.new(500) @exception_status.update(options[:exception_status]) if options[:exception_status] end
# File lib/rack/show_stackdeck.rb, line 30 def call(env) @app.call(env) rescue StandardError, ScriptError, Timeout::Error => e data, status = pretty_data(env, e) [status, {"Content-Type" => "text/html"}, [@template.result(data)]] end