ShopifySharp 6.12.0
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 baseShopifyException
. This new exception should be thrown whenever an http request fails or returns an error. - Made the
ShopifyRateLimitException
inherit from theShopifyHttpException
. - Deprecated most HTTP properties on the base
ShopifyException
:HttpStatusCode
RequestId
Errors
RawBody
- Removed the deprecated
ShopifyException.HttpResponse
property. - Refactored the base
ShopifyService
,GraphService
andPartnerService
classes to throw aShopifyHttpException
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
- Exception refactoring by @nozzlegear in #996
- Fix X-ShopId header check when header value is empty by @nozzlegear in #997
- Enhanced retry strategies for Leaky Bucket and Retry policies by @nozzlegear in #998
Full Changelog: ShopifySharp/6.11.0...ShopifySharp/6.12.0