Class: Appsignal::Rack::JSExceptionCatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/rack/js_exception_catcher.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of JSExceptionCatcher.



4
5
6
7
# File 'lib/appsignal/rack/js_exception_catcher.rb', line 4

def initialize(app, options = {})
  Appsignal.logger.debug 'Initializing Appsignal::Rack::JSExceptionCatcher'
  @app, @options = app, options
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/appsignal/rack/js_exception_catcher.rb', line 9

def call(env)
  if env['PATH_INFO'] == Appsignal.config[:frontend_error_catching_path]
    body        = JSON.parse(env['rack.input'].read)
    transaction = JSExceptionTransaction.new(body)
    transaction.complete!

    return [ 200, {}, []]
  else
    @app.call(env)
  end
end