Function: toFailureView()
GalaChain core SDK 1.0.0-rc.8 / index / toFailureView
Function: toFailureView()
toFailureView(
value):FailureView|undefined
Defined in: packages/gala-core-sdk/dist/index.d.ts:2146
Reads the failure view of any value: a GalaSDKError, or a plain object with a string code
(and, optionally, params, status, phase, uniqueKey, shadow, notFound). Anything else
(a string, a wallet error with a numeric code, null) has no view and is undefined.
Having a view does not mean the SDK knows the code: an ethers error is { code: 'ACTION_REJECTED' } and has a view too. The SDK's guards compare the code with the catalog.
Parameters
value
unknown
Returns
FailureView | undefined
Example
const view = toFailureView(error); // an SDK error, or an app's `{ code, params, status }` wrapper
if (view?.code === 'CHAIN_REJECTED') showChainRejection(view.params);