Exception: Loqate::Error

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

Overview

Generic error returned from an API call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, description:, cause:, resolution:) ⇒ Error

Instantiates an error



35
36
37
38
39
40
41
42
# File 'lib/loqate/error.rb', line 35

def initialize(id:, description:, cause:, resolution:)
  super(description)

  @id = id
  @cause = cause
  @resolution = resolution
  @description = description
end

Instance Attribute Details

#causeString (readonly)

What caused the error



20
21
22
# File 'lib/loqate/error.rb', line 20

def cause
  @cause
end

#descriptionString (readonly)

Descriptive information about the error



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

def description
  @description
end

#idInteger (readonly)

Unique identifier for the error



8
9
10
# File 'lib/loqate/error.rb', line 8

def id
  @id
end

#resolutionString (readonly)

How to solve the error



26
27
28
# File 'lib/loqate/error.rb', line 26

def resolution
  @resolution
end

Instance Method Details

#==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compare the equality of this error with other. Two errors are considered equal if they have the same id.



52
53
54
# File 'lib/loqate/error.rb', line 52

def ==(other)
  other.is_a?(Error) && id == other.id
end