Class: Consulkit::Middleware::RaiseError

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/consulkit/middleware/raise_error.rb

Overview

This class raises a Consulkit-flavored exception based on the HTTP status codes returned by the API.

Instance Method Summary collapse

Instance Method Details

#on_complete(response) ⇒ Object



11
12
13
14
15
# File 'lib/consulkit/middleware/raise_error.rb', line 11

def on_complete(response)
  return unless (error = Consulkit::Error.from_response(response))

  raise error
end