Function: isShadowError
isShadowError(
value):boolean
True when value is a failure of the shadow (dark) path: an SDK error with shadow: true, a
plain-object view of one ({ code, shadow: true }, see FailureView), or a non-SDK object (a requestor's own rejection) that escaped swapShadow, submitSwapShadow or
ChainGateway.submitShadow. A primitive that was thrown (throw 'x') cannot be remembered, so
it is never shadow; an app that cares tracks the call it made.
failure view swap shadow submit chain gateway
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
boolean
Example
try {
await swaps.swapShadow('GALA', 'GUSDC', 3000, { exactIn: '100' });
} catch (error) {
const { retryable } = classifyFailure(error);
offerRetry(retryable && !isShadowError(error)); // never retry a dark swap in public
}