Exception: ThinkificRuby::ApiError

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

Constant Summary collapse

DEFAULT_MSG =
"There was an error with your API request. Check the status code and response_body for details."

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, response, msg = DEFAULT_MSG) ⇒ ApiError

we’ll still give it an optional error message, but leave it as the default which will tell them to check the status and body in the error object



9
10
11
12
13
14
# File 'lib/thinkific_ruby/api_error.rb', line 9

def initialize(status_code, response, msg=DEFAULT_MSG)
  @status_code = status_code
  @response = response

  super(msg)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



3
4
5
# File 'lib/thinkific_ruby/api_error.rb', line 3

def status_code
  @status_code
end