Errors
The error class the SDK throws, and the two guards that recognise its errors.
The SDK throws two errors. Errors shows a catch block that tells them apart,
and Results and errors lists every reason.
NimbusSdkError
The error the SDK throws when it cannot go on. Read its reason to decide what to tell the user.
The error every function of this package throws when it cannot go on.
class NimbusSdkError extends Error {
readonly name = "NimbusSdkError";
readonly reason: NimbusSdkErrorReason;
constructor(
reason: NimbusSdkErrorReason,
message: string,
cause:
| { readonly kind: "none" }
| { readonly kind: "cause"; readonly cause: unknown },
);
}Types used: NimbusSdkErrorReason
Compare reason, not the message, and test for the error with isNimbusSdkError, which
holds across bundles where instanceof does not.
Generated from the TSDoc in sdks/typescript/nimbus-solana-web/src/errors.ts.
isNimbusSdkError
Use it in a catch block to recognise a NimbusSdkError and read its reason.
function isNimbusSdkError(thrown: unknown): thrown is NimbusSdkError;Types used: NimbusSdkError
Example
import { , } from "@umbra/nimbus-solana-web";
try {
await ({ : "mainnet" });
} catch () {
if (() && . === "misconfigured") {
.(.);
}
}Parameters
Prop
Type
Returns
thrown is NimbusSdkError
Whether it is named NimbusSdkError and carries one of its reasons.
Returns whether a thrown value is a NimbusSdkError, from this bundle or another copy of
the package.
Generated from the TSDoc in sdks/typescript/nimbus-solana-web/src/errors.ts.
isNimbusSolanaFlowError
Use it in a catch block around a payment, to recognise the protocol's refusals.
function isNimbusSolanaFlowError(
value: unknown,
): value is NimbusSolanaFlowError;Types used: NimbusSolanaFlowError
Parameters
Prop
Type
Returns
value is NimbusSolanaFlowError
Whether it is one.
Returns whether a value is a NimbusSolanaFlowError, by its name and reason.
Generated from the TSDoc in sdks/typescript/nimbus-solana/src/context/errors.ts.
Last updated