# File lib/rack/showexceptions.rb, line 23 def call(env) @app.call(env) rescue StandardError, LoadError, SyntaxError => e exception_string = dump_exception(e) env["rack.errors"].puts(exception_string) env["rack.errors"].flush if prefers_plain_text?(env) content_type = "text/plain" body = [exception_string] else content_type = "text/html" body = pretty(env, e) end [500, {"Content-Type" => content_type, "Content-Length" => Rack::Utils.bytesize(body.join).to_s}, body] end