Exception: Swiftner::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Swiftner::Error
- Defined in:
- lib/swiftner/error.rb
Overview
Encapsulates all errors that can be raised by the Swiftner API
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, response: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, response: nil) ⇒ Error
Returns a new instance of Error.
14 15 16 17 |
# File 'lib/swiftner/error.rb', line 14 def initialize(, response: nil) @response = response super() end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/swiftner/error.rb', line 6 def response @response end |
Class Method Details
.from_response(response) ⇒ Object
8 9 10 11 12 |
# File 'lib/swiftner/error.rb', line 8 def self.from_response(response) return new(response["detail"], response: response) if response.key?("detail") new(response.to_s, response: response) end |