lib/peddler/errors/error.rb in peddler-1.6.7 vs lib/peddler/errors/error.rb in peddler-2.0.0

- old
+ new

@@ -1,28 +1,38 @@ # frozen_string_literal: true +require 'forwardable' + module Peddler # @api private module Errors - # Here I curate error classes I see value in creating up front so we can use - # them for control flow. All other errors will be created at runtime. + # 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 - InvalidMarketplace + 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