Exception: Vangrail::HTTPError
- Defined in:
- lib/vangrail/errors.rb
Overview
A 4xx or 5xx with the body kept for the operator.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, body) ⇒ HTTPError
constructor
A new instance of HTTPError.
- #retryable? ⇒ Boolean
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
22 23 24 |
# File 'lib/vangrail/errors.rb', line 22 def body @body end |
#status ⇒ Object (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
30 31 32 |
# File 'lib/vangrail/errors.rb', line 30 def retryable? status >= 500 || status == 429 end |