Class: DwollaV2::HandleErrors

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ HandleErrors

Returns a new instance of HandleErrors.



3
4
5
# File 'lib/dwolla_v2/middleware/handle_errors.rb', line 3

def initialize app
  @app = app
end

Instance Method Details

#call(request_env) ⇒ Object



7
8
9
10
11
# File 'lib/dwolla_v2/middleware/handle_errors.rb', line 7

def call request_env
  @app.call(request_env).on_complete do |response_env|
    Error.raise!(response_env) if response_env.status >= 400
  end
end