Class: Acme::Client::HTTPClient::ErrorMiddleware

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

Overview

ErrorMiddleware ensures the HTTP Client would not raise exceptions outside the Acme namespace.

Exceptions are rescued and re-packaged as Acme exceptions.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

Implements the Rack-alike Faraday::Middleware interface.



48
49
50
51
52
# File 'lib/acme/client/http_client.rb', line 48

def call(env)
  @app.call(env)
rescue Faraday::TimeoutError, Faraday::ConnectionFailed
  raise Acme::Client::Error::Timeout
end