Exception: MonkeylearnResponseError

Inherits:
MonkeylearnError show all
Defined in:
lib/monkeylearn/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#detailObject

Returns the value of attribute detail.



7
8
9
# File 'lib/monkeylearn/exceptions.rb', line 7

def detail
  @detail
end

#error_codeObject

Returns the value of attribute error_code.



7
8
9
# File 'lib/monkeylearn/exceptions.rb', line 7

def error_code
  @error_code
end

#status_codeObject

Returns the value of attribute status_code.



7
8
9
# File 'lib/monkeylearn/exceptions.rb', line 7

def status_code
  @status_code
end