retry
Built-in middleware that retries transport / provider failures with
linear backoff. Errors matched by name to CartUserError,
CartNotFoundError, and CartCapabilityUnsupportedError propagate
immediately — they are deterministic and a retry would never resolve
them. All other errors retry up to attempts times; on final failure
the last error is rethrown.
Signature
function retry(opts: { attempts: number; backoffMs: number }): CartMiddleware;Parameters
| Name | Type | Description |
|---|---|---|
opts | { attempts: number; backoffMs: number } |
Returns
A that retries retryable failures.
Example
const kernel = createCart({
adapter,
middleware: [retry({ attempts: 3, backoffMs: 200 })],
});Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
ProductSnapshot
Denormalized product data captured at addtocart time and carried on the addline mutation. Allows UI layers to render optimistic line items before the adapter ro
RunCartAdapterContractOpts
Options accepted by . Passed once per adapter under test; the suite name and factory are the only inputs the contract runner needs from the host test file.