Function: isRelayableRefusal
Call Signature
isRelayableRefusal(
error):error is GSwapSDKError<RelayableCode>
True when the error is a gateway refusal whose params.serverMessage an app may relay to the
person as the gateway sent it: GATEWAY_REPORTED_ERROR, the gateway bounces (METHOD_NOT_ALLOWED,
SIGNATURE_INVALID, SIGNER_MISMATCH, DTO_INVALID, BOUNDS_VIOLATION, SYMBOL_CONFLICT,
RATE_LIMITED, GATEWAY_REJECTED) and CHAIN_DISPATCH_FAILED. The app shows serverMessage when
it is not empty and its own line when it is; the SDK's English message is never what to show.
It accepts a plain-object view of an SDK error too (FailureView: an app's wrapper with a
code), and decides from the code in the same way. It narrows to GSwapSDKError<...> ONLY when
called with an SDK error; with an unknown or a view it answers boolean (narrow with
isGSwapError first, or read the view's own params).
It is a test on the code alone, so it also holds for CHAIN_DISPATCH_FAILED with HTTP 409
(the uniqueKey was already consumed; classifyFailure says unknown): an app that words that
case itself ("already submitted", then confirm the key) checks error.status === 409 BEFORE
relaying. It is false for CHAIN_REJECTED (the chain's verdict, worded by where it is shown: the
submit and confirm screens differ), for HTTP_ERROR (a proxy's page, not an answer to this
write) and for the five unproven acknowledgements (isUnprovenAcknowledgement: they carry no
server text).
swap sdk error relayable code server message gateway reported method not allowed signature invalid signer mismatch dto bounds violation symbol conflict rate limited rejected chain dispatch failed is unique key classify failure http unproven acknowledgement
Parameters
| Parameter | Type |
|---|---|
error | GSwapSDKError |
swap sdk error
Returns
error is GSwapSDKError<RelayableCode>
swap sdk error relayable code
Example
if (isRelayableRefusal(error)) show(error.params.serverMessage || t('swap.requestFailed'));
Call Signature
isRelayableRefusal(
error):boolean
True when the error is a gateway refusal whose params.serverMessage an app may relay to the
person as the gateway sent it: GATEWAY_REPORTED_ERROR, the gateway bounces (METHOD_NOT_ALLOWED,
SIGNATURE_INVALID, SIGNER_MISMATCH, DTO_INVALID, BOUNDS_VIOLATION, SYMBOL_CONFLICT,
RATE_LIMITED, GATEWAY_REJECTED) and CHAIN_DISPATCH_FAILED. The app shows serverMessage when
it is not empty and its own line when it is; the SDK's English message is never what to show.
It accepts a plain-object view of an SDK error too (FailureView: an app's wrapper with a
code), and decides from the code in the same way. It narrows to GSwapSDKError<...> ONLY when
called with an SDK error; with an unknown or a view it answers boolean (narrow with
isGSwapError first, or read the view's own params).
It is a test on the code alone, so it also holds for CHAIN_DISPATCH_FAILED with HTTP 409
(the uniqueKey was already consumed; classifyFailure says unknown): an app that words that
case itself ("already submitted", then confirm the key) checks error.status === 409 BEFORE
relaying. It is false for CHAIN_REJECTED (the chain's verdict, worded by where it is shown: the
submit and confirm screens differ), for HTTP_ERROR (a proxy's page, not an answer to this
write) and for the five unproven acknowledgements (isUnprovenAcknowledgement: they carry no
server text).
server message gateway reported error method not allowed signature invalid signer mismatch dto bounds violation symbol conflict rate limited rejected chain dispatch failed swap sdk is unique key classify failure http unproven acknowledgement
Parameters
| Parameter | Type |
|---|---|
error | unknown |
Returns
boolean
Example
if (isRelayableRefusal(error)) show(error.params.serverMessage || t('swap.requestFailed'));