Exception: CleverSDK::Error
- Inherits:
-
StandardError
- Object
- StandardError
- CleverSDK::Error
- Defined in:
- lib/clever_sdk/error.rb
Instance Attribute Summary collapse
-
#action_to_take ⇒ Object
Returns the value of attribute action_to_take.
-
#code ⇒ Object
Returns the value of attribute code.
-
#meaning ⇒ Object
Returns the value of attribute meaning.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#action_to_take ⇒ Object
Returns the value of attribute action_to_take.
21 22 23 |
# File 'lib/clever_sdk/error.rb', line 21 def action_to_take @action_to_take end |
#code ⇒ Object
Returns the value of attribute code.
21 22 23 |
# File 'lib/clever_sdk/error.rb', line 21 def code @code end |
#meaning ⇒ Object
Returns the value of attribute meaning.
21 22 23 |
# File 'lib/clever_sdk/error.rb', line 21 def meaning @meaning end |
#response ⇒ Object
Returns the value of attribute response.
21 22 23 |
# File 'lib/clever_sdk/error.rb', line 21 def response @response end |
Class Method Details
.handle(faraday_response) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/clever_sdk/error.rb', line 5 def self.handle(faraday_response) explanation = CleverSDK::Api::Response.status_code_explanations[faraday_response.status] error_obj = if explanation.nil? new else new([explanation[:meaning], explanation[:action_to_take]].join(": ")) end error_obj.response = faraday_response error_obj.code = faraday_response.status error_obj.meaning = explanation[:meaning] if explanation error_obj.action_to_take = explanation[:action_to_take] if explanation error_obj end |
Instance Method Details
#intitialize(message = "Unknown API error") ⇒ Object
23 24 25 |
# File 'lib/clever_sdk/error.rb', line 23 def intitialize( = "Unknown API error") super() end |