Exception: MonkeylearnResponseError
- Inherits:
-
MonkeylearnError
- Object
- StandardError
- MonkeylearnError
- MonkeylearnResponseError
- Defined in:
- lib/monkeylearn/exceptions.rb
Direct Known Subclasses
AuthenticationError, ForbiddenError, ModuleStateError, PlanQueryLimitError, RateLimitError, RequestParamsError, ResourceNotFound
Instance Attribute Summary collapse
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ MonkeylearnResponseError
constructor
A new instance of MonkeylearnResponseError.
Constructor Details
#initialize(raw_response) ⇒ MonkeylearnResponseError
Returns a new instance of MonkeylearnResponseError.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/monkeylearn/exceptions.rb', line 9 def initialize(raw_response) @response = raw_response body = JSON.parse(raw_response.body) @detail = body['detail'] @error_code = body['error_code'] @status_code = raw_response.status super "#{@error_code}: #{@detail}" end |
Instance Attribute Details
#detail ⇒ Object
Returns the value of attribute detail.
7 8 9 |
# File 'lib/monkeylearn/exceptions.rb', line 7 def detail @detail end |
#error_code ⇒ Object
Returns the value of attribute error_code.
7 8 9 |
# File 'lib/monkeylearn/exceptions.rb', line 7 def error_code @error_code end |
#status_code ⇒ Object
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/monkeylearn/exceptions.rb', line 7 def status_code @status_code end |