Sha256: 52c804991838bab18542a71b85018fd4525dfcbc9f949d810f452e35186a1cad

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 Bytes

Contents

module Greeve
  # HTTP response failed.
  class ResponseError < StandardError
    # HTTP error code
    attr_reader :code
    # HTTP error message
    attr_reader :status_message

    # @option opts [Integer] :code HTTP error code
    # @option opts [String] :status_message HTTP error message
    def initialize(opts = {})
      @code = opts.fetch(:code).to_i
      @status_message = opts.fetch(:status_message).dup.freeze
    end

    # @return [String] exception error message
    def message
      "#{@code} #{@status_message}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
greeve-1.0.0 lib/greeve/response_error.rb