1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# frozen_string_literal: true
# :markup: markdown
require "rack/body_proxy"
module ActionDispatch
class Executor
def initialize(app, executor)
@app, @executor = app, executor
end
def call(env)
state = @executor.run!(reset: true)
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
returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
rescue => error
@executor.error_reporter.report(error, handled: false, source: "application.action_dispatch")
raise
ensure
state.complete! unless returned
end
end
end
end
|