Sha256: 9dd729e9be21076cdfb3980c2819c9e2095759158e24fb981668dbe97b455231
Contents?: true
Size: 1.02 KB
Versions: 19
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require 'json' module RailsSpotlight module Middlewares class MainRequestHandler def initialize(app) @app = app end attr_reader :app def call(env) app_request = AppRequest.new env['action_dispatch.request_id'] app_request.current! app.call(env) rescue StandardError => e if defined?(ActionDispatch::ExceptionWrapper) wrapper = if ActionDispatch::ExceptionWrapper.method_defined? :env ActionDispatch::ExceptionWrapper.new(env, e) else ActionDispatch::ExceptionWrapper.new(env['action_dispatch.backtrace_cleaner'], e) end app_request.events.push(*Event.events_for_exception(wrapper)) else app_request.events.push(*Event.events_for_exception(e)) end raise ensure Storage.new(app_request.id).write(app_request.events.to_json) unless app_request.events.empty? end end end end
Version data entries
19 entries across 19 versions & 1 rubygems