Sha256: e11bd3e0a13de7911b4ed5bfcb797aef597e7102cc3f96c77f9911384108b95b

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

module ThinkificRuby
  class ApiError < StandardError
    attr_reader :status_code
    attr_reader :response

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

    # 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
    def initialize(status_code, response, msg=DEFAULT_MSG)
      @status_code = status_code
      @response = response

      super(msg)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinkific_ruby_test-0.1.0 lib/thinkific_ruby/api_error.rb