Exception: Rsplunk::APIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rsplunk/api_error.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (APIError) initialize(error, response)



7
8
9
10
# File 'lib/rsplunk/api_error.rb', line 7

def initialize(error, response)
  @code   = error.status
  @response = response
end

Instance Attribute Details

- (Object) code (readonly)

Returns the value of attribute code



4
5
6
# File 'lib/rsplunk/api_error.rb', line 4

def code
  @code
end

- (Object) response (readonly)

Returns the value of attribute response



5
6
7
# File 'lib/rsplunk/api_error.rb', line 5

def response
  @response
end

Instance Method Details

- (Object) message Also known as: to_s

Return the HTTP code and response (404):Unknown sid



14
15
16
# File 'lib/rsplunk/api_error.rb', line 14

def message
  "(#{@code}):#{@response["response"]["messages"]["msg"]}"
end