Sha256: 7b532bbb8b8706b1112df3e28e02d21ba06994870cc5c6ba15b77b92e358cafa

Contents?: true

Size: 832 Bytes

Versions: 5

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module Peddler
  # @api private
  module Errors
    # These error codes are common to all Amazon MWS API sections.
    #
    # @see https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Errors.html
    CODES = %w[
      AccessDenied
      InputStreamDisconnected
      InternalError
      InvalidAccessKeyId
      InvalidAddress
      InvalidParameterValue
      QuotaExceeded
      RequestThrottled
      SignatureDoesNotMatch
    ].freeze

    # @api private
    class Error < StandardError
      extend Forwardable

      attr_reader :cause

      def initialize(msg = nil, cause = nil)
        @cause = cause
        super msg
      end

      def_delegator :cause, :response
    end

    CODES.each do |name|
      const_set name, Class.new(Error)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
peddler-2.1.1 lib/peddler/errors/error.rb
peddler-2.1.0 lib/peddler/errors/error.rb
peddler-2.0.4 lib/peddler/errors/error.rb
peddler-2.0.3 lib/peddler/errors/error.rb
peddler-2.0.0 lib/peddler/errors/error.rb