Class: Zerobounce::Middleware::RaiseError

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

Overview

Raises an error if the response wasn’t successful.

Author:

  • Aaron Frase

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object

Check for errors after the response has finished.

Parameters:

  • env (Hash)

Raises:



16
17
18
19
20
# File 'lib/zerobounce/middleware/raise_error.rb', line 16

def on_complete(env)
  if (error = Zerobounce::Error.from_response(env)) # rubocop:disable GuardClause
    raise error
  end
end