Exception: Hook0::TransportError
- Inherits:
-
StandardError
- Object
- StandardError
- Hook0::TransportError
- Defined in:
- lib/hook0/transport.rb
Overview
A request the API never answered, and what caused that.
The three causes are told apart because only one of them could end differently. A request that got no answer — a connection refused or reset, an attempt out of time, a body that stopped mid-way — says nothing about whether the API acted on it, which is exactly why a send carries an identifier the client chose itself, and why repeating it is safe and worth doing. An answer that crossed a ceiling this client set for itself draws the same answer the second time, and reading it again four times over costs the caller four times as much for the same failure. A URL nothing can be sent to was never sent at all, and a repetition builds the same unusable request, turning a misconfiguration into a message that accuses the network.
The names are the ones the shared conformance corpus gives them, so the verdict a client applies and the verdict that corpus writes down are the same words.
Instance Attribute Summary collapse
-
#cause_name ⇒ String
readonly
Which of the corpus's causes this is.
Class Method Summary collapse
-
.answer_above_a_bound(detail) ⇒ TransportError
The API answered, and what it answered crossed a ceiling this client set for itself.
-
.no_answer(detail) ⇒ TransportError
The API was reached for and answered nothing this client could read to its end.
-
.unusable_api_url(detail) ⇒ TransportError
There is nowhere to send the request, so nothing was sent.
Instance Method Summary collapse
-
#initialize(detail, cause_name, retryable) ⇒ TransportError
constructor
A new instance of TransportError.
-
#retryable? ⇒ Boolean
Whether repeating the request that met this could end differently.
Constructor Details
#initialize(detail, cause_name, retryable) ⇒ TransportError
Returns a new instance of TransportError.
30 31 32 33 34 |
# File 'lib/hook0/transport.rb', line 30 def initialize(detail, cause_name, retryable) super(detail) @cause_name = cause_name @retryable = retryable end |
Instance Attribute Details
#cause_name ⇒ String (readonly)
Returns which of the corpus's causes this is.
25 26 27 |
# File 'lib/hook0/transport.rb', line 25 def cause_name @cause_name end |
Class Method Details
.answer_above_a_bound(detail) ⇒ TransportError
The API answered, and what it answered crossed a ceiling this client set for itself.
55 56 57 |
# File 'lib/hook0/transport.rb', line 55 def self.answer_above_a_bound(detail) new(detail, "answer_above_a_bound", false) end |
.no_answer(detail) ⇒ TransportError
The API was reached for and answered nothing this client could read to its end.
47 48 49 |
# File 'lib/hook0/transport.rb', line 47 def self.no_answer(detail) new(detail, "no_answer", true) end |
.unusable_api_url(detail) ⇒ TransportError
There is nowhere to send the request, so nothing was sent.
63 64 65 |
# File 'lib/hook0/transport.rb', line 63 def self.unusable_api_url(detail) new(detail, "unusable_api_url", false) end |
Instance Method Details
#retryable? ⇒ Boolean
Whether repeating the request that met this could end differently.
39 40 41 |
# File 'lib/hook0/transport.rb', line 39 def retryable? @retryable end |