Exception: VerifIP::VerifIPError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/verifip/errors.rb

Overview

Base error class for all VerifIP API errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status_code: 0, error_code: "", retry_after: nil) ⇒ VerifIPError

Returns a new instance of VerifIPError.



15
16
17
18
19
20
# File 'lib/verifip/errors.rb', line 15

def initialize(message = nil, status_code: 0, error_code: "", retry_after: nil)
  super(message)
  @status_code = status_code
  @error_code  = error_code || ""
  @retry_after = retry_after
end

Instance Attribute Details

#error_codeString (readonly)

Returns machine-readable error code from the API.

Returns:

  • (String)

    machine-readable error code from the API



10
11
12
# File 'lib/verifip/errors.rb', line 10

def error_code
  @error_code
end

#retry_afterInteger? (readonly)

Returns suggested seconds to wait before retrying.

Returns:

  • (Integer, nil)

    suggested seconds to wait before retrying



13
14
15
# File 'lib/verifip/errors.rb', line 13

def retry_after
  @retry_after
end

#status_codeInteger (readonly)

Returns HTTP status code (0 for connection errors).

Returns:

  • (Integer)

    HTTP status code (0 for connection errors)



7
8
9
# File 'lib/verifip/errors.rb', line 7

def status_code
  @status_code
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/verifip/errors.rb', line 22

def to_s
  "#{self.class.name}(#{status_code}, '#{error_code}', '#{message}')"
end