Sha256: f5e0523a72eb6063362c289dd1e3f0ecfad8e43fb5d2147434a7333b6a407129

Contents?: true

Size: 336 Bytes

Versions: 18

Compression:

Stored size: 336 Bytes

Contents

require 'rest-core/middleware'

class RestCore::ErrorHandler
  def self.members; [:error_handler]; end
  include RestCore::Middleware

  def call env
    handle(app.call(handle(env)))
  end

  def handle env
    if error_handler(env) && !(env[FAIL] || []).empty?
      error_handler(env).call(env)
    else
      env
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rest-core-0.8.2 lib/rest-core/middleware/error_handler.rb
rest-core-0.8.1 lib/rest-core/middleware/error_handler.rb
rest-core-0.8.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.7.2 lib/rest-core/middleware/error_handler.rb
rest-core-0.7.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.4.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.4.0.pre.2 lib/rest-core/middleware/error_handler.rb
rest-core-0.4.0.pre.1 lib/rest-core/middleware/error_handler.rb
rest-core-0.4.0.pre.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.3.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.3.0.pre.2 lib/rest-core/middleware/error_handler.rb
rest-core-0.3.0.pre.1 lib/rest-core/middleware/error_handler.rb
rest-core-0.3.0.pre.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.2.3 lib/rest-core/middleware/error_handler.rb
rest-core-0.2.2 lib/rest-core/middleware/error_handler.rb
rest-core-0.2.1 lib/rest-core/middleware/error_handler.rb
rest-core-0.2.0 lib/rest-core/middleware/error_handler.rb
rest-core-0.0.1 lib/rest-core/middleware/error_handler.rb