Class: Preservation::Client::ErrorFaradayMiddleware

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

Overview

This wraps any faraday connection errors with preservation-client errors see www.rubydoc.info/gems/faraday/Faraday/ClientError for info on errors

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
# File 'lib/preservation/client/error_faraday_middleware.rb', line 8

def call(env)
  @app.call(env)
rescue Faraday::ConnectionFailed, Faraday::SSLError, Faraday::TimeoutError => e
  raise ConnectionFailedError, "Unable to reach Preservation Catalog - failed with #{e.class}: #{e.message}"
end