Function: isPreSendError
isPreSendError(
value):boolean
True when value is an SDK error that was thrown BEFORE anything was transmitted
(error.phase === 'pre_send'): validation, symbol resolution, the signer, the wallet, a key
provider. A write that failed this way cannot have been queued, so the failure never calls for
"confirm before you retry". Every failure of an app-supplied callback that runs BEFORE the
request leaves reaches you as an SDK error of this kind (SIGNING_FAILED,
KEY_PROVIDER_FAILED, TOKEN_RESOLUTION_FAILED, the original error as cause), so an app
never needs an error class of its own to tell "nothing was sent" apart.
Whether to offer Retry is classifyFailure(error).retryable, not this: a pre-send validation
error is pre-send too, and repeating the same call fails the same way.
It also answers for a plain-object view of an SDK error ({ code, phase? }, see
FailureView): the view's own phase, else the catalog's phase for its code (a core code or
a DEX code). It is a plain boolean, not a type guard (a view is not a GSwapSDKError); use
isGSwapError to narrow.
pre send signing failed key provider token resolution classify failure view swap sdk error is
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
boolean
Example
if (isPreSendError(error)) markNothingSent(); // no pending swap to confirm