Exception: Minisky::BadResponse

Inherits:
Error
  • Object
show all
Defined in:
lib/minisky/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, status_message, data) ⇒ BadResponse

Returns a new instance of BadResponse.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/minisky/errors.rb', line 16

def initialize(status, status_message, data)
  @status = status
  @data = data

  message = if error_message
    "#{status} #{status_message}: #{error_message}"
  else
    "#{status} #{status_message}"
  end

  super(message)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



14
15
16
# File 'lib/minisky/errors.rb', line 14

def data
  @data
end

#statusObject (readonly)

Returns the value of attribute status.



14
15
16
# File 'lib/minisky/errors.rb', line 14

def status
  @status
end

Instance Method Details

#error_messageObject



33
34
35
# File 'lib/minisky/errors.rb', line 33

def error_message
  @data['message'] if @data.is_a?(Hash)
end

#error_typeObject



29
30
31
# File 'lib/minisky/errors.rb', line 29

def error_type
  @data['error'] if @data.is_a?(Hash)
end