class Sinatra::ShowExceptions
def call(env)
def call(env) @app.call(env) rescue Exception => e errors, env["rack.errors"] = env["rack.errors"], @@eats_errors if prefers_plain_text?(env) content_type = "text/plain" exception = dump_exception(e) else content_type = "text/html" exception = pretty(env, e) end env["rack.errors"] = errors # Post 893a2c50 in rack/rack, the #pretty method above, implemented in # Rack::ShowExceptions, returns a String instead of an array. body = Array(exception) [ 500, { "Content-Type" => content_type, "Content-Length" => body.join.bytesize.to_s }, body ] end