Sha256: aad62d0da96dfcc55e700e67f4a11be06ae7819589155bf34241ac481cb62114

Contents?: true

Size: 770 Bytes

Versions: 54

Compression:

Stored size: 770 Bytes

Contents

module Stripe
  class StripeError < StandardError
    attr_reader :message
    attr_reader :http_status
    attr_reader :http_body
    attr_reader :http_headers
    attr_reader :request_id
    attr_reader :json_body

    def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil,
                   http_headers=nil)
      @message = message
      @http_status = http_status
      @http_body = http_body
      @http_headers = http_headers || {}
      @json_body = json_body
      @request_id = @http_headers[:request_id]
    end

    def to_s
      status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
      id_string = @request_id.nil? ? "" : "(Request #{@request_id}) "
      "#{status_string}#{id_string}#{@message}"
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
stripe-1.30.2 lib/stripe/errors/stripe_error.rb
stripe-1.30.1 lib/stripe/errors/stripe_error.rb
stripe-1.30.0 lib/stripe/errors/stripe_error.rb
stripe-1.29.1 lib/stripe/errors/stripe_error.rb
stripe-1.29.0 lib/stripe/errors/stripe_error.rb
stripe-1.28.1 lib/stripe/errors/stripe_error.rb
stripe-1.28.0 lib/stripe/errors/stripe_error.rb
stripe-1.27.2 lib/stripe/errors/stripe_error.rb
stripe-1.27.1 lib/stripe/errors/stripe_error.rb
stripe-1.27.0 lib/stripe/errors/stripe_error.rb
stripe-1.26.0 lib/stripe/errors/stripe_error.rb
stripe-1.25.0 lib/stripe/errors/stripe_error.rb
stripe-1.24.0 lib/stripe/errors/stripe_error.rb
stripe-1.23.0 lib/stripe/errors/stripe_error.rb