Function: classification()
gSwap SDK 2.0.0-rc.4 / classification
Function: classification()
classification(
outcome,options?):FailureClassification
Defined in: packages/gswap-sdk/dist/index.d.ts:3997
Builds the classification the SDK itself gives an outcome, so an app that classifies a step of
its OWN (one that is not an SDK call) uses the SDK's type and its values instead of a
hard-coded { outcome, retryable } literal. retryable is the SDK's default for that outcome
(false for unknown and invalid_input, true for the rest). Each call returns a new
object, safe to mutate or freeze.
options.retryable: false WITHHOLDS Retry from an outcome that would otherwise allow it: the
SDK's own not_queued for a refusal the gateway will repeat is
classification('not_queued', { retryable: false }) (also exported, frozen, as
NOT_QUEUED_FINAL). An app may take Retry away from an outcome but never grant it to one
that cannot have it, so only false is accepted.
Parameters
outcome
"rejected" | "unknown" | "not_queued" | "not_sent" | "invalid_input" | "transient"
options?
retryable?
false
Returns
Example
// The app refreshes a quote before it asks the SDK to sign; the refresh failed.
throw new AppSwapError(text, classification('not_sent'));
// The app refuses a request for a reason a repeat cannot fix.
throw new AppSwapError(text, classification('not_queued', { retryable: false }));