Sha256: b9773ca393fb7e52ce4580c2dc0da00e808fb7237cf48ae9c64de7f54737c2c1

Contents?: true

Size: 464 Bytes

Versions: 4

Compression:

Stored size: 464 Bytes

Contents

module Tvdb2

  # Exception raised when an http request to an endpoint return a status code
  # different from 200 or 404.
  class RequestError < StandardError

    attr_reader :response, :code, :error

    # @param [HTTParty::Response] response the HTTParty response object.
    def initialize(response)
      super(response['Error'] || response.message)
      @response = response
      @code = response.code
      @error = response['Error']
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tvdb2-0.1.3 lib/tvdb2/request_error.rb
tvdb2-0.1.2 lib/tvdb2/request_error.rb
tvdb2-0.1.1 lib/tvdb2/request_error.rb
tvdb2-0.1.0 lib/tvdb2/request_error.rb