Exception: Vangrail::HTTPError

Inherits:
Error
  • Object
show all
Defined in:
lib/vangrail/errors.rb

Overview

A 4xx or 5xx with the body kept for the operator.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, body) ⇒ HTTPError

Returns a new instance of HTTPError.



27
28
29
30
31
# File 'lib/vangrail/errors.rb', line 27

def initialize(status, body)
  @status = status
  @body = body.to_s
  super("HTTP #{status}: #{@body[0, 400]}")
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



25
26
27
# File 'lib/vangrail/errors.rb', line 25

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



25
26
27
# File 'lib/vangrail/errors.rb', line 25

def status
  @status
end

Instance Method Details

#retryable?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/vangrail/errors.rb', line 33

def retryable?
  status >= 500 || status == 429
end