Sha256: af54a05fee441cf6de1f316e3200418e4245c7e34d98d40a0e72397b16a90942

Contents?: true

Size: 559 Bytes

Versions: 11

Compression:

Stored size: 559 Bytes

Contents

# frozen_string_literal: true

module Preservation
  class Client
    # This wraps any faraday connection errors with preservation-client errors
    # see https://www.rubydoc.info/gems/faraday/Faraday/ClientError for info on errors
    class ErrorFaradayMiddleware < Faraday::Middleware
      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
preservation-client-7.0.1 lib/preservation/client/error_faraday_middleware.rb
preservation-client-7.0.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-6.2.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-6.1.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-6.0.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-5.3.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-5.2.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-5.1.1 lib/preservation/client/error_faraday_middleware.rb
preservation-client-5.1.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-5.0.0 lib/preservation/client/error_faraday_middleware.rb
preservation-client-4.0.0 lib/preservation/client/error_faraday_middleware.rb