Exception: ChartMogul::ChartMogulError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/chartmogul/errors/chartmogul_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, http_status: nil, response: nil) ⇒ ChartMogulError

Returns a new instance of ChartMogulError.



7
8
9
10
11
# File 'lib/chartmogul/errors/chartmogul_error.rb', line 7

def initialize(message, http_status:nil, response:nil)
  @message = message
  @http_status = http_status
  @response = response
end

Instance Attribute Details

#http_statusObject

Returns the value of attribute http_status.



5
6
7
# File 'lib/chartmogul/errors/chartmogul_error.rb', line 5

def http_status
  @http_status
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/chartmogul/errors/chartmogul_error.rb', line 3

def message
  @message
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/chartmogul/errors/chartmogul_error.rb', line 4

def response
  @response
end

Instance Method Details

#to_sObject



13
14
15
16
17
# File 'lib/chartmogul/errors/chartmogul_error.rb', line 13

def to_s
  status = @http_status ? " (HTTP Status: #{@http_status.to_s})" : ''
  response = @response ? "\nResponse: #{@response.to_s}" : ''
  "#{message}#{status}#{response}"
end