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.
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
25 26 27 |
# File 'lib/vangrail/errors.rb', line 25 def body @body end |
#status ⇒ Object (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
33 34 35 |
# File 'lib/vangrail/errors.rb', line 33 def retryable? status >= 500 || status == 429 end |