Class: Isono::Rack::ThreadPass

Inherits:
Decorator show all
Includes:
Logger
Defined in:
lib/isono/rack/thread_pass.rb

Instance Attribute Summary

Attributes inherited from Decorator

#app

Instance Method Summary collapse

Methods included from Logger

included, initialize

Methods inherited from Decorator

#initialize

Constructor Details

This class inherits a constructor from Isono::Rack::Decorator

Instance Method Details

#call(req, res) ⇒ Object



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

def call(req, res)
  ::Thread.new {
    begin
      app.call(req, res)
    rescue Exception => e
      logger.error(e)
      res.response(e) unless res.responded?
    else
      raise ResponseIncompleteError unless res.responded?
    end
  }
end