Skip to content

ShopifySharp 6.12.0

Compare
Choose a tag to compare
@github-actions github-actions released this 18 Jan 17:50
· 113 commits to master since this release
9778f21

What's Changed

Bug fixes

A bug was fixed in #997 that could cause the ShopifyDomainUtility.IsValidShopDomainAsync method to erroneously return true in cases where the response contained an X-ShopId header with an empty value. (#995)

ShopifyException refactoring

The following changes were made to the exception classes in ShopifySharp:

  • Introduced a new exception type named ShopifyHttpException, which inherits from the base ShopifyException. This new exception should be thrown whenever an http request fails or returns an error.
  • Made the ShopifyRateLimitException inherit from the ShopifyHttpException.
  • Deprecated most HTTP properties on the base ShopifyException:
    • HttpStatusCode
    • RequestId
    • Errors
    • RawBody
  • Removed the deprecated ShopifyException.HttpResponse property.
  • Refactored the base ShopifyService, GraphService and PartnerService classes to throw a ShopifyHttpException where applicable.
  • Removed a custom error message that was injected into the ShopifyException.Errors string list in some cases. This error message was an exact duplicate of the exception's message.

Leaky Bucket Execution Policy and Retry Execution Policy enhancements

Added small enhancements to the Leaky Bucket execution policy and the Retry execution policy to make them retry certain common request http request failures. I've based this code off of the retry policy found in Microsoft's Azure.Core SDK (MIT licensed), though it's not quite a one-to-one match since we don't have the concept of an HTTP pipeline in ShopifySharp.

These are the status codes that will be retried if a request fails in the Leaky Bucket and Retry execution policies:

case 408: // Request Timeout
case 429: // Too Many Requests
case 500: // Internal Server Error
case 502: // Bad Gateway
case 503: // Service Unavailable
case 504: // Gateway Timeout

The policies will retry these requests up to three times before throwing a ShopifyHttpException.

Importantly, the default behavior of the Leaky Bucket and Retry policies should remain intact -- they won't start retrying additional responses unless you opt-in to the behavior by using the new constructor overloads on each policy. I wanted to make this change available for testing and feedback right now, so I can gather some feedback on it.

Pull requests

Full Changelog: ShopifySharp/6.11.0...ShopifySharp/6.12.0