Functions
isSolanaError
isSolanaError<
TErrorCode
>(e
,code?
):e is SolanaError<TErrorCode>
A type guard that returns true
if the input is a SolanaError, optionally with a
particular error code.
When the code
argument is supplied and the input is a SolanaError, TypeScript will
refine the error's `context` property to the type associated with
that error code. You can use that context to render useful error messages, or to make
context-aware decisions that help your application to recover from the error.
Type Parameters
Type Parameter |
---|
TErrorCode extends SolanaErrorCode |
Parameters
Parameter | Type | Description |
---|---|---|
e | unknown | - |
code? | TErrorCode | When supplied, this function will require that the input is a SolanaError and that its error code is exactly this value. |
Returns
e is SolanaError<TErrorCode>