Sha256: e37d3027855dbb9a80dbb4aa8c92523d929d016b37fe9fcb0a74f8f62c4f988b

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

Stored size: 736 Bytes

Contents

# Exception class raised whenever the underlying client receives an error response.
#
# [API]
#   Documentation:
#
class NexaasID::Client::Exception < StandardError
  # Creates an instance of this exception.
  #
  # @param [String] message The exception message.
  # @param [#status, #headers, #body] response The client's HTTP response object.
  def initialize(message, response)
    super(message)
    @response = response
  end

  # @return [Integer] HTTP response's status.
  def status
    @response.status if @response
  end

  # @return [Integer] HTTP response's headers.
  def headers
    @response.headers if @response
  end

  # @return [Integer] HTTP response's body.
  def body
    @response ? @response.body : ''
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nexaas_id-client-0.7.4 lib/nexaas_id/client/exception.rb
nexaas_id-client-0.7.3 lib/nexaas_id/client/exception.rb
nexaas_id-client-0.7.2 lib/nexaas_id/client/exception.rb
nexaas_id-client-0.7.1 lib/nexaas_id/client/exception.rb
nexaas_id-client-0.7.0 lib/nexaas_id/client/exception.rb
nexaas_id-client-0.6.0 lib/nexaas_id/client/exception.rb
nexaas_id-client-0.5.0 lib/nexaas_id/client/exception.rb