class Stripe::StripeError

errors derive.
StripeError is the base error from which all other more specific Stripe

def construct_error_object

def construct_error_object
  return nil if @json_body.nil? || !@json_body.key?(:error)
  ErrorObject.construct_from(@json_body[:error])
end

def idempotent_replayed?

because the user sent the same idempotency key for this one.
originally occurred on a previous request and is being replayed back
Whether the error was the result of an idempotent replay, meaning that it
def idempotent_replayed?
  @idempotent_replayed
end

def initialize(message = nil, http_status: nil, http_body: nil,

Initializes a StripeError.
def initialize(message = nil, http_status: nil, http_body: nil,
               json_body: nil, http_headers: nil, code: nil)
  @message = message
  @http_status = http_status
  @http_body = http_body
  @http_headers = http_headers || {}
  @idempotent_replayed = @http_headers["idempotent-replayed"] == "true"
  @json_body = json_body
  @code = code
  @request_id = @http_headers["request-id"]
  @error = construct_error_object
end

def to_s

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