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
AuthenticationError, 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.
19 20 21 22 23 |
# File 'lib/mistri/errors.rb', line 19 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.
17 18 19 |
# File 'lib/mistri/errors.rb', line 17 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
17 18 19 |
# File 'lib/mistri/errors.rb', line 17 def status @status end |
Class Method Details
.default_message ⇒ Object
34 |
# File 'lib/mistri/errors.rb', line 34 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.
27 28 29 30 31 32 |
# File 'lib/mistri/errors.rb', line 27 def describe parts = [] parts << "status #{status}" if status parts << body.to_s[0, 300] if body && !body.to_s.strip.empty? parts.join(" | ") end |