Sha256: 3554c98b13ca405c7b5e6695bd400aba7a2e9561fb2cc3eecf7d56f502e36e07

Contents?: true

Size: 712 Bytes

Versions: 6

Compression:

Stored size: 712 Bytes

Contents

class EasyPost::Error < StandardError
  attr_reader :message
  attr_reader :status
  attr_reader :http_status # deprecated
  attr_reader :http_body
  attr_reader :code
  attr_reader :errors

  def initialize(message = nil, status = nil, code = nil, errors = nil, http_body = nil)
    @message = message
    @status = status
    @http_status = status # deprecated
    @code = code
    @errors = errors
    @http_body = http_body

    super(message)
  end

  def to_s
    "#{code} (#{status}): #{message} #{errors}".strip
  end

  def ==(other)
    other.is_a?(EasyPost::Error) &&
      message == other.message &&
      status == other.status &&
      code == other.code &&
      errors == other.errors
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easypost-3.5.1 lib/easypost/error.rb
easypost-3.5.0 lib/easypost/error.rb
easypost-3.4.0 lib/easypost/error.rb
easypost-3.3.0 lib/easypost/error.rb
easypost-3.2.0 lib/easypost/error.rb
easypost-3.1.5 lib/easypost/error.rb