1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Merge pull request #907 from kgrz/fix-error-with-rack-master

Update ShowExceptions to suit latest rack master
This commit is contained in:
Zachary Scott 2014-08-10 20:23:34 -07:00
commit a43ba2c65a

View file

@ -24,18 +24,24 @@ module Sinatra
if prefers_plain_text?(env)
content_type = "text/plain"
body = [dump_exception(e)]
exception_string = dump_exception(e)
else
content_type = "text/html"
body = pretty(env, e)
exception_string = pretty(env, e)
end
env["rack.errors"] = errors
[500,
# Post 893a2c50 in rack/rack, the #pretty method above, implemented in
# Rack::ShowExceptions, returns a String instead of an array.
body = Array(exception_string)
[
500,
{"Content-Type" => content_type,
"Content-Length" => Rack::Utils.bytesize(body.join).to_s},
body]
body
]
end
private