Exception: Mistri::ProviderError
- Defined in:
- lib/mistri/errors.rb
Overview
A provider request failed. Carries the HTTP status and response body when the transport got that far.
Direct Known Subclasses
AmbiguousDeliveryError, AuthenticationError, InvalidRequestError, OverloadedError, RateLimitError, ServerError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#describe ⇒ Object
The full story for logs and error turns: the response names the fix far more often than the status line does.
-
#initialize(message = nil, status: nil, body: nil) ⇒ ProviderError
constructor
A new instance of ProviderError.
Constructor Details
#initialize(message = nil, status: nil, body: nil) ⇒ ProviderError
Returns a new instance of ProviderError.
23 24 25 26 27 |
# File 'lib/mistri/errors.rb', line 23 def initialize( = nil, status: nil, body: nil) @status = status @body = body super( || self.class.) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
21 22 23 |
# File 'lib/mistri/errors.rb', line 21 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
21 22 23 |
# File 'lib/mistri/errors.rb', line 21 def status @status end |
Class Method Details
.default_message ⇒ Object
38 |
# File 'lib/mistri/errors.rb', line 38 def self. = "provider request failed" |
Instance Method Details
#describe ⇒ Object
The full story for logs and error turns: the response names the fix far more often than the status line does.
31 32 33 34 35 36 |
# File 'lib/mistri/errors.rb', line 31 def describe parts = [] parts << "status #{status}" if status parts << body.to_s[0, 300] if body && !body.to_s.strip.empty? parts.join(" | ") end |