Errors
The two errors the SDK throws, the guards that recognise them, and a catch block that tells them apart.
Most of what your user can cause comes back as a result, such as declined. The SDK throws only
when your app usually cannot fix things by asking the user. It throws one of two errors:
| Error | What it means | Guard |
|---|---|---|
NimbusSdkError | The SDK could not go on: a setting, the browser, the wallet or a service. | isNimbusSdkError |
NimbusSolanaFlowError | The protocol refused the payment, such as an amount too small to cover the fee. | isNimbusSolanaFlowError |
Each carries a reason. Compare the reason, never the message. The message is for your logs.
Catch them
Use the guards, not instanceof. A guard still works when your bundle holds two copies of the SDK.
import {
,
,
,
} from "@umbra/nimbus-solana-web";
try {
await (, { : , : 5_000_000n, : });
} catch () {
if (()) {
.(., .);
("The payment was refused. Check the amount and the recipient.");
} else if (()) {
.(., .);
("Something went wrong. Try again in a moment.");
} else {
throw ;
}
}Rethrow anything neither guard knows. It is a bug in your app or in the SDK, not a refusal.
A NimbusSolanaFlowError also carries detail, the names and counts that locate the refusal. It
never holds keys, so it is safe to log.
Results and errors lists every reason of both errors, with what to do about each.
Next
Last updated