Sha256: 67f0dae3afc61e78795bbed9dc9cedcdde4a4d57b00aab78782ea5149e8f5200

Contents?: true

Size: 829 Bytes

Versions: 12

Compression:

Stored size: 829 Bytes

Contents

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

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

          if body['name'].is_a?(String) && body['name'].length > 0
            transaction = JSExceptionTransaction.new(body)
            transaction.complete!
            code = 200
          else
            Appsignal.logger.debug "JSExceptionCatcher: Could not send exception, 'name' is empty."
            code = 422
          end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
appsignal-2.0.6 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.5 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.5.beta.1 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.1.0.alpha.3 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.1.0.alpha.2 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.1.0.alpha.1 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.4 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.3 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.2 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.1 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.0 lib/appsignal/rack/js_exception_catcher.rb
appsignal-2.0.0.beta.1 lib/appsignal/rack/js_exception_catcher.rb