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

Parameters:

  • id (Integer)

    Unique identifier for the error

  • description (String)

    Descriptive information about the error

  • cause (String)

    What caused the error

  • resolution (String)

    How to solve the 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

Returns:

  • (String)


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

def cause
  @cause
end

#descriptionString (readonly)

Descriptive information about the error

Returns:

  • (String)


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

def description
  @description
end

#idInteger (readonly)

Unique identifier for the error

Returns:

  • (Integer)


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

def id
  @id
end

#resolutionString (readonly)

How to solve the error

Returns:

  • (String)


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.

Parameters:

  • other (Error)

    Another error

Returns:

  • (Boolean)


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

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