Skip to content
API reference

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

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

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

Generated from the TSDoc in sdks/typescript/nimbus-solana/src/context/errors.ts.

Last updated

On this page