Class: ShopifyAPI::MessageEnricher
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ShopifyAPI::MessageEnricher
- Defined in:
- lib/shopify_api/message_enricher.rb
Instance Method Summary collapse
Instance Method Details
#message ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/shopify_api/message_enricher.rb', line 3 def return super unless (400...500).include?(code.to_i) @_cached_message ||= begin detailed_error = begin parsed_body = JSON.parse(body) if parsed_body['error'] parsed_body['error'].to_s elsif parsed_body['errors'] Array(parsed_body['errors']).join('; ') end rescue JSON::ParserError nil end detailed_error.present? ? "#{super} (#{detailed_error})" : super end end |