class RestCore::ErrorHandler

Public Class Methods

members() click to toggle source
# File lib/rest-core/middleware/error_handler.rb, line 4
def self.members; [:error_handler]; end

Public Instance Methods

call(env) { |if empty? || find{ |ff| kind_of?(Exception) } || !h res else fail(res, call) end| ... } click to toggle source
# File lib/rest-core/middleware/error_handler.rb, line 7
def call env
  app.call(env){ |res|
    h = error_handler(res)
    f = res[FAIL] || []
    yield(if f.empty? || f.find{ |ff| ff.kind_of?(Exception) } || !h
            res
          else
            fail(res, h.call(res))
          end)}
end