Exception: HumanTone::Errors::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status_code: nil, request_id: nil, error_code: nil, details: nil, retryable: nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/humantone/errors.rb', line 8

def initialize(message,
               status_code: nil,
               request_id: nil,
               error_code: nil,
               details: nil,
               retryable: nil)
  super(message)
  @status_code = status_code
  @request_id = request_id
  @error_code = error_code
  @details = details
  @retryable_override = retryable
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



6
7
8
# File 'lib/humantone/errors.rb', line 6

def details
  @details
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



6
7
8
# File 'lib/humantone/errors.rb', line 6

def error_code
  @error_code
end

#request_idObject (readonly)

Returns the value of attribute request_id.



6
7
8
# File 'lib/humantone/errors.rb', line 6

def request_id
  @request_id
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



6
7
8
# File 'lib/humantone/errors.rb', line 6

def status_code
  @status_code
end

Instance Method Details

#inspectObject



29
30
31
32
33
# File 'lib/humantone/errors.rb', line 29

def inspect
  "#<#{self.class.name}: #{message.inspect} " \
    "(code=#{error_code.inspect}, status=#{status_code.inspect}, " \
    "request_id=#{request_id.inspect}, retryable=#{retryable?})>"
end

#retryable?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
# File 'lib/humantone/errors.rb', line 22

def retryable?
  override = @retryable_override
  return override unless override.nil?

  default_retryable
end