Class: PeakFlowUtils::NotifierRack

Inherits:
Object
  • Object
show all
Defined in:
lib/peak_flow_utils/notifier_rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ NotifierRack

Returns a new instance of NotifierRack.



2
3
4
5
# File 'lib/peak_flow_utils/notifier_rack.rb', line 2

def initialize(app, options = {})
  @app = app
  @options = options
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/peak_flow_utils/notifier_rack.rb', line 7

def call(env)
  @app.call(env)
rescue Exception => e # rubocop:disable Lint/RescueException
  controller = env["action_controller.instance"]
  request = controller&.request

  PeakFlowUtils::Notifier.with_parameters(rack: {get: request.GET, post: request.POST}) do
    PeakFlowUtils::Notifier.notify(
      environment: env,
      error: e
    )
  end

  raise e
end