Skip to main content

Function: isGalaErrorLike()

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / index / isGalaErrorLike

Function: isGalaErrorLike()

isGalaErrorLike(value): value is GalaErrorShape

Defined in: packages/gala-core-sdk/dist/index.d.ts:1083

True when value is an SDK error (it carries the brand) or a plain-object VIEW of one: a string code and an object params, which is the shape of GalaSDKError and of the wrapper objects an app builds from one ({ code, params, status?, phase?, ... }). A wallet's own error (an EIP-1193 numeric code, an ethers error with a string code and no params) is neither. It says the value has the SDK's shape, not that code is a code the SDK knows.

Parameters​

value​

unknown

Returns​

value is GalaErrorShape

Example​

if (isGalaErrorLike(error)) report(error.code, error.params); // no `instanceof`, no SDK import