class Handler
A middleware which catches exceptions and performs an internal redirect.
Definitions
def initialize(app, location = '/errors/exception')
Implementation
def initialize(app, location = '/errors/exception')
@app = app
@location = location
end
def fatal_error(env, exception)
Generate a very simple fatal error response. This function should be unlikely to fail. Additionally, it generates a lowest common denominator response which should be suitable as a response to any kind of request. Ideally, this response is also not good or useful for any kind of higher level browser or API client, as this is not a normal error path but one that represents broken behaviour.
Implementation
def fatal_error(env, exception)
body = StringIO.new
write_exception_to_stream(body, env, exception)
body.rewind
return [500, {HTTP::CONTENT_TYPE => "text/plain"}, body]
end