Exception: CompletionKit::ProviderError
- Defined in:
- lib/completion_kit/errors.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, status: nil) ⇒ ProviderError
constructor
A new instance of ProviderError.
Constructor Details
#initialize(message = nil, status: nil) ⇒ ProviderError
Returns a new instance of ProviderError.
20 21 22 23 |
# File 'lib/completion_kit/errors.rb', line 20 def initialize( = nil, status: nil) super() @status = status end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
18 19 20 |
# File 'lib/completion_kit/errors.rb', line 18 def status @status end |
Class Method Details
.from_client_error(text) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/completion_kit/errors.rb', line 25 def self.from_client_error(text) detail = text.to_s.sub(/\AError:\s*/, "") if (match = detail.match(/\A(\d{3})\s*-\s*(.*)/m)) new(match[2], status: match[1].to_i) else new(detail) end end |