Class: Schneiderlein::FlyCatcher

Inherits:
Struct
  • Object
show all
Defined in:
lib/schneiderlein/fly_catcher.rb

Constant Summary collapse

PARSE_ERROR_CONSTANT =
if Rails.version.to_f < 5.1
  ActionDispatch::ParamsParser::ParseError
else
  ActionDispatch::Http::Parameters::ParseError
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



3
4
5
# File 'lib/schneiderlein/fly_catcher.rb', line 3

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/schneiderlein/fly_catcher.rb', line 12

def call(env)
  app.call(env)
rescue PARSE_ERROR_CONSTANT => e
  env['rack.schneiderlein.parse_errors'] ||= []
  env['rack.schneiderlein.parse_errors'] << e
  app.call(remove_errors_from(env))
end