Class: ExceptionHandler::Parse

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_handler/parse.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Parse

Init



5
6
7
# File 'lib/exception_handler/parse.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Exception



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/exception_handler/parse.rb', line 10

def call(env)
@app.call(env)

rescue Exception => exception 
  request     = ActionDispatch::Request.new(env)
  controller  = request.env['action_controller.instance']
  ignore      = ExceptionHandler::Parser::Ignore.new(exception, request).match?

  ExceptionHandler::Parser::Data.create exception, request, controller unless ignore
  raise exception
end