Class: XeroKiwi::Client::ResponseHandler

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/xero_kiwi/client.rb

Overview

Faraday middleware that maps non-2xx responses onto our exception hierarchy. Lives outside the retry middleware so it only fires on the final response.

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



548
549
550
551
552
# File 'lib/xero_kiwi/client.rb', line 548

def on_complete(env)
  return if (200..299).cover?(env.status)

  raise error_for(env)
end