Sha256: ff40e256cd45c87e57b8e377ab542af82db15a5c3fe9dd9290e28a7b9259d95a

Contents?: true

Size: 389 Bytes

Versions: 3

Compression:

Stored size: 389 Bytes

Contents

module Twitch
  # An error returned by the API.
  class ApiError < StandardError
    # HTTP status code of the response.
    attr_reader :status_code
    # Body content of the response.
    attr_reader :body

    def initialize(status_code, body)
      @status_code = status_code
      @body = body

      msg = "The server returned error #{status_code}"
      super(msg)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitch-api-0.4.0 lib/twitch/api_error.rb
twitch-api-0.3.0 lib/twitch/api_error.rb
twitch-api-0.2.0 lib/twitch/api_error.rb