wallet/functions/isGalaErrorLike.md
isGalaErrorLike(
value):value is GalaErrorShape
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.
gala error shape sdk
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
value is GalaErrorShape
gala error shape
Example
if (isGalaErrorLike(error)) report(error.code, error.params); // no `instanceof`, no SDK import