Exception: Zerobounce::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/zerobounce/error.rb

Overview

The base Zerobounce error.

Author:

  • Aaron Frase

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env = {}) ⇒ Error

Returns a new instance of Error.



14
15
16
17
# File 'lib/zerobounce/error.rb', line 14

def initialize(env={})
  @env = env
  super(env[:body])
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



12
13
14
# File 'lib/zerobounce/error.rb', line 12

def env
  @env
end

Class Method Details

.from_response(env) ⇒ Error?

Parse the response for errors.

Parameters:

  • env (Hash)

Returns:



24
25
26
27
28
29
30
31
32
33
# File 'lib/zerobounce/error.rb', line 24

def from_response(env)
  case env[:status]
  when 500
    parse500(env)
  when 200
    parse200(env)
  else
    UnknownError.new(env)
  end
end