Function: classification
classification(
outcome,options?):FailureClassification
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.
failure classification invalid input not queued
Parameters
| Parameter | Type |
|---|---|
outcome | "rejected" | "unknown" | "not_queued" | "not_sent" | "invalid_input" | "transient" |
options? | { retryable?: false; } |
options.retryable? | false |
not queued sent invalid input
Returns
failure classification
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 }));