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.



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

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.



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

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#retryable?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/vangrail/errors.rb', line 30

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