Class: ExceptionLog::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_log/middleware.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Middleware.



6
7
8
9
# File 'lib/exception_log/middleware.rb', line 6

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/exception_log/middleware.rb', line 11

def call(env)
  @app.call(env)
rescue Exception => e
  pid = fork {
    ExceptionLog::Handler.new(env,e,@options).do
  }
  Process.detach(pid)
  raise e
end