instance method
call
Ruby on Rails edge
Since v5.0.7.2Signature
call(env)
No documentation comment.
Parameters
-
envreq
Source
# File actionpack/lib/action_dispatch/middleware/executor.rb, line 13
def call(env)
state = @executor.run!(reset: true)
completed = false
finalize = -> {
next if completed
completed = true
state.complete!
}
if response_finished = env["rack.response_finished"]
response_finished << proc { finalize.call }
end
begin
response = @app.call(env)
if env["action_dispatch.report_exception"]
error = env["action_dispatch.exception"]
@executor.error_reporter.report(error, handled: false, source: "application.action_dispatch")
end
if hijacked?(env, response)
# `close` and `rack.response_finished` may never fire on hijack.
# Release eagerly; the request's autoloaded code is resolved by now.
finalize.call
elsif !response_finished
response << ::Rack::BodyProxy.new(response.pop) { finalize.call }
end
returned = true
response
rescue Exception => error
request = ActionDispatch::Request.new env
backtrace_cleaner = request.get_header("action_dispatch.backtrace_cleaner")
wrapper = ExceptionWrapper.new(backtrace_cleaner, error)
@executor.error_reporter.report(wrapper.unwrapped_exception, handled: false, source: "application.action_dispatch")
raise
ensure
if !returned && !response_finished
finalize.call
end
end
end
Defined in actionpack/lib/action_dispatch/middleware/executor.rb line 13
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Executor