Sha256: 6eecea56ef07fcf5e2203fb83406f2c1d19c4d079f1d47156e1cc279f14555a8

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

require 'zerobounce/error'

module Zerobounce
  # Faraday middleware.
  module Middleware
    # Raises an error if the response wasn't successful.
    class RaiseError < Faraday::Response::Middleware
      # Check for errors after the response has finished.
      def on_complete(env)
        if (error = Zerobounce::Error.from_response(env)) # rubocop:disable GuardClause
          raise error
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zerobounce-0.0.1 lib/zerobounce/middleware/raise_error.rb