class Epuber::Server::ShowExceptions

Public Instance Methods

call(env) click to toggle source
# File lib/epuber/server.rb, line 34
def call(env)
  e = env['sinatra.error']

  if prefers_plain_text?(env)
    content_type = 'text/plain'
    body = [dump_exception(e)]
  else
    content_type = 'text/html'
    body = pretty(env, e)
  end

  unless body.is_a?(Array)
    body = [body]
  end

  [500, { 'Content-Type'   => content_type,
          'Content-Length' => Rack::Utils.bytesize(body.join).to_s },
   body]
end