Sha256: 48c6f714c445d516fad83d2b5ea47baf427cb8e2fa30dad5297be21c4141ca6e

Contents?: true

Size: 401 Bytes

Versions: 2

Compression:

Stored size: 401 Bytes

Contents

module ShopifyAPI
  class MessageEnricher < SimpleDelegator
    def message
      return super unless (400...500).include?(code.to_i)

      @_cached_message ||= begin
        detailed_error = begin
          JSON.parse(body)['error'].to_s
        rescue JSON::ParserError
          nil
        end

        detailed_error.present? ? "#{super} (#{detailed_error})" : super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shopify_api-9.0.0 lib/shopify_api/message_enricher.rb
shopify_api-8.1.0 lib/shopify_api/message_enricher.rb