Class: Increase::Middleware::RaiseApiError

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/increase/middleware/raise_api_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



6
7
8
9
10
# File 'lib/increase/middleware/raise_api_error.rb', line 6

def on_complete(env)
  return if env[:status] < 400

  raise Increase::ApiError.from_response(env)
end