Class: ReamazeAPI::Client::RaiseErrorMiddleware

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

Overview

Raises a ReamazeAPI::Error for any HTTP response code 400-599.

Instance Method Summary collapse

Instance Method Details

#on_complete(response) ⇒ void (private)

This method returns an undefined value.

Private: Raises a ReamazeAPI::Error for any HTTP response code 400-599.

Parameters:

  • response

    HTTP response (Faraday::Env)



16
17
18
19
20
# File 'lib/reamaze_api/client.rb', line 16

def on_complete(response)
  if error = ReamazeAPI::Error.from_response(response)
    raise error
  end
end