Exception: Colore::Errors::APIError

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

Overview

Base class for API errors

Direct Known Subclasses

ClientError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_code, message, rsp_backtrace = nil, response_body = nil) ⇒ APIError

Initializes the API error.

Parameters:

  • http_code (Integer)

    the HTTP status code

  • message (String)

    the error message

  • rsp_backtrace (Array<String>) (defaults to: nil)

    the backtrace from the response

  • response_body (String) (defaults to: nil)

    the response body



24
25
26
27
28
29
# File 'lib/colore/errors.rb', line 24

def initialize(http_code, message, rsp_backtrace = nil, response_body = nil)
  super(message)
  @http_code = http_code
  @response_body = response_body
  @rsp_backtrace = rsp_backtrace
end

Instance Attribute Details

#http_codeObject

Returns the value of attribute http_code.



16
17
18
# File 'lib/colore/errors.rb', line 16

def http_code
  @http_code
end

#response_bodyObject

Returns the value of attribute response_body.



16
17
18
# File 'lib/colore/errors.rb', line 16

def response_body
  @response_body
end

#rsp_backtraceObject

Returns the value of attribute rsp_backtrace.



16
17
18
# File 'lib/colore/errors.rb', line 16

def rsp_backtrace
  @rsp_backtrace
end