Skip to content
SwapKit is a powerful suite of tools for building blockchain applications.

SwapKitError

Defined in: packages/helpers/src/modules/swapKitError.ts:177

  • Error

new SwapKitError(errorOrErrorKey, sourceErrorOrInfo?): SwapKitError

Defined in: packages/helpers/src/modules/swapKitError.ts:180

"core_estimated_max_spendable_chain_not_supported" | "core_extend_error" | "core_inbound_data_not_found" | "core_approve_asset_address_or_from_not_found" | "core_plugin_not_found" | "core_plugin_swap_not_found" | "core_approve_asset_target_invalid" | "core_explorer_unsupported_chain" | "core_verify_message_not_supported" | "core_chain_halted" | "core_wallet_connection_not_found" | "core_wallet_ctrl_not_installed" | "core_wallet_evmwallet_not_installed" | "core_wallet_walletconnect_not_installed" | "core_wallet_keystore_not_installed" | "core_wallet_ledger_not_installed" | "core_wallet_trezor_not_installed" | "core_wallet_keplr_not_installed" | "core_wallet_okx_not_installed" | "core_wallet_keepkey_not_installed" | "core_wallet_talisman_not_installed" | "core_wallet_not_keypair_wallet" | "core_wallet_sign_message_not_supported" | "core_wallet_connection_failed" | "core_swap_invalid_params" | "core_swap_route_not_complete" | "core_swap_asset_not_recognized" | "core_swap_contract_not_found" | "core_swap_route_transaction_not_found" | "core_swap_contract_not_supported" | "core_swap_transaction_error" | "core_swap_quote_mode_not_supported" | "core_transaction_deposit_error" | "core_transaction_create_liquidity_base_error" | "core_transaction_create_liquidity_asset_error" | "core_transaction_create_liquidity_invalid_params" | "core_transaction_add_liquidity_invalid_params" | "core_transaction_add_liquidity_base_address" | "core_transaction_add_liquidity_base_error" | "core_transaction_add_liquidity_asset_error" | "core_transaction_withdraw_error" | "core_transaction_deposit_to_pool_error" | "core_transaction_deposit_insufficient_funds_error" | "core_transaction_deposit_gas_error" | "core_transaction_invalid_sender_address" | "core_transaction_deposit_server_error" | "core_transaction_user_rejected" | "core_transaction_failed" | "core_transaction_invalid_recipient_address" | "wallet_connection_rejected_by_user" | "wallet_missing_api_key" | "wallet_chain_not_supported" | "wallet_missing_params" | "wallet_provider_not_found" | "wallet_failed_to_add_or_switch_network" | "wallet_ledger_connection_error" | "wallet_ledger_connection_claimed" | "wallet_ledger_get_address_error" | "wallet_ledger_device_not_found" | "wallet_ledger_device_locked" | "wallet_phantom_not_found" | "wallet_ctrl_not_found" | "wallet_ctrl_send_transaction_no_address" | "wallet_ctrl_contract_address_not_provided" | "wallet_ctrl_asset_not_defined" | "wallet_walletconnect_project_id_not_specified" | "wallet_walletconnect_connection_not_established" | "wallet_walletconnect_namespace_not_supported" | "wallet_trezor_failed_to_sign_transaction" | "wallet_trezor_derivation_path_not_supported" | "wallet_trezor_failed_to_get_address" | "wallet_talisman_not_enabled" | "wallet_talisman_not_found" | "wallet_polkadot_not_found" | "wallet_radix_not_found" | "wallet_radix_transaction_failed" | "wallet_keepkey_not_found" | "wallet_keepkey_asset_not_defined" | "wallet_keepkey_contract_address_not_provided" | "wallet_keepkey_send_transaction_no_address" | "wallet_bitkeep_not_found" | "wallet_exodus_sign_transaction_error" | "wallet_keystore_invalid_password" | "wallet_keystore_unsupported_version" | "wallet_onekey_not_found" | "wallet_onekey_sign_transaction_error" | "chainflip_channel_error" | "chainflip_unknown_asset" | "chainflip_broker_invalid_params" | "chainflip_broker_recipient_error" | "chainflip_broker_register" | "chainflip_broker_tx_error" | "chainflip_broker_withdraw" | "chainflip_broker_fund_only_flip_supported" | "chainflip_broker_fund_invalid_address" | "thorchain_chain_halted" | "thorchain_trading_halted" | "thorchain_swapin_router_required" | "thorchain_swapin_vault_required" | "thorchain_swapin_memo_required" | "thorchain_swapin_token_required" | "thorchain_preferred_asset_payout_required" | "api_v2_invalid_response" | "api_v2_server_error" | "api_v2_invalid_method_key_hash" | "toolbox_cosmos_signer_not_defined" | "toolbox_cosmos_no_accounts_found" | "toolbox_cosmos_verify_signature_no_pubkey" | "toolbox_cosmos_validate_address_prefix_not_found" | "toolbox_evm_no_abi_fragment" | "toolbox_evm_no_signer" | "toolbox_evm_no_signer_address" | "toolbox_evm_no_from_address" | "toolbox_evm_no_contract_address" | "toolbox_evm_no_fee_data" | "toolbox_evm_no_gas_price" | "toolbox_evm_no_to_address" | "toolbox_evm_invalid_gas_asset_address" | "toolbox_evm_provider_not_eip1193_compatible" | "toolbox_evm_error_estimating_gas_limit" | "toolbox_evm_error_sending_transaction" | "toolbox_radix_signer_not_defined" | "toolbox_solana_no_signer" | "toolbox_solana_fee_estimation_failed" | "toolbox_ripple_rpc_not_configured" | "toolbox_ripple_signer_not_found" | "toolbox_ripple_asset_not_supported" | "toolbox_ripple_broadcast_error" | "toolbox_ripple_get_balance_error" | "helpers_invalid_number_different_decimals" | "helpers_invalid_number_of_years" | "helpers_invalid_identifier" | "helpers_invalid_asset_url" | "helpers_invalid_asset_identifier" | "helpers_invalid_memo_type" | "helpers_failed_to_switch_network" | "helpers_not_found_provider" | "not_implemented" | { errorKey: "core_estimated_max_spendable_chain_not_supported" | "core_extend_error" | "core_inbound_data_not_found" | "core_approve_asset_address_or_from_not_found" | "core_plugin_not_found" | "core_plugin_swap_not_found" | "core_approve_asset_target_invalid" | "core_explorer_unsupported_chain" | "core_verify_message_not_supported" | "core_chain_halted" | "core_wallet_connection_not_found" | "core_wallet_ctrl_not_installed" | "core_wallet_evmwallet_not_installed" | "core_wallet_walletconnect_not_installed" | "core_wallet_keystore_not_installed" | "core_wallet_ledger_not_installed" | "core_wallet_trezor_not_installed" | "core_wallet_keplr_not_installed" | "core_wallet_okx_not_installed" | "core_wallet_keepkey_not_installed" | "core_wallet_talisman_not_installed" | "core_wallet_not_keypair_wallet" | "core_wallet_sign_message_not_supported" | "core_wallet_connection_failed" | "core_swap_invalid_params" | "core_swap_route_not_complete" | "core_swap_asset_not_recognized" | "core_swap_contract_not_found" | "core_swap_route_transaction_not_found" | "core_swap_contract_not_supported" | "core_swap_transaction_error" | "core_swap_quote_mode_not_supported" | "core_transaction_deposit_error" | "core_transaction_create_liquidity_base_error" | "core_transaction_create_liquidity_asset_error" | "core_transaction_create_liquidity_invalid_params" | "core_transaction_add_liquidity_invalid_params" | "core_transaction_add_liquidity_base_address" | "core_transaction_add_liquidity_base_error" | "core_transaction_add_liquidity_asset_error" | "core_transaction_withdraw_error" | "core_transaction_deposit_to_pool_error" | "core_transaction_deposit_insufficient_funds_error" | "core_transaction_deposit_gas_error" | "core_transaction_invalid_sender_address" | "core_transaction_deposit_server_error" | "core_transaction_user_rejected" | "core_transaction_failed" | "core_transaction_invalid_recipient_address" | "wallet_connection_rejected_by_user" | "wallet_missing_api_key" | "wallet_chain_not_supported" | "wallet_missing_params" | "wallet_provider_not_found" | "wallet_failed_to_add_or_switch_network" | "wallet_ledger_connection_error" | "wallet_ledger_connection_claimed" | "wallet_ledger_get_address_error" | "wallet_ledger_device_not_found" | "wallet_ledger_device_locked" | "wallet_phantom_not_found" | "wallet_ctrl_not_found" | "wallet_ctrl_send_transaction_no_address" | "wallet_ctrl_contract_address_not_provided" | "wallet_ctrl_asset_not_defined" | "wallet_walletconnect_project_id_not_specified" | "wallet_walletconnect_connection_not_established" | "wallet_walletconnect_namespace_not_supported" | "wallet_trezor_failed_to_sign_transaction" | "wallet_trezor_derivation_path_not_supported" | "wallet_trezor_failed_to_get_address" | "wallet_talisman_not_enabled" | "wallet_talisman_not_found" | "wallet_polkadot_not_found" | "wallet_radix_not_found" | "wallet_radix_transaction_failed" | "wallet_keepkey_not_found" | "wallet_keepkey_asset_not_defined" | "wallet_keepkey_contract_address_not_provided" | "wallet_keepkey_send_transaction_no_address" | "wallet_bitkeep_not_found" | "wallet_exodus_sign_transaction_error" | "wallet_keystore_invalid_password" | "wallet_keystore_unsupported_version" | "wallet_onekey_not_found" | "wallet_onekey_sign_transaction_error" | "chainflip_channel_error" | "chainflip_unknown_asset" | "chainflip_broker_invalid_params" | "chainflip_broker_recipient_error" | "chainflip_broker_register" | "chainflip_broker_tx_error" | "chainflip_broker_withdraw" | "chainflip_broker_fund_only_flip_supported" | "chainflip_broker_fund_invalid_address" | "thorchain_chain_halted" | "thorchain_trading_halted" | "thorchain_swapin_router_required" | "thorchain_swapin_vault_required" | "thorchain_swapin_memo_required" | "thorchain_swapin_token_required" | "thorchain_preferred_asset_payout_required" | "api_v2_invalid_response" | "api_v2_server_error" | "api_v2_invalid_method_key_hash" | "toolbox_cosmos_signer_not_defined" | "toolbox_cosmos_no_accounts_found" | "toolbox_cosmos_verify_signature_no_pubkey" | "toolbox_cosmos_validate_address_prefix_not_found" | "toolbox_evm_no_abi_fragment" | "toolbox_evm_no_signer" | "toolbox_evm_no_signer_address" | "toolbox_evm_no_from_address" | "toolbox_evm_no_contract_address" | "toolbox_evm_no_fee_data" | "toolbox_evm_no_gas_price" | "toolbox_evm_no_to_address" | "toolbox_evm_invalid_gas_asset_address" | "toolbox_evm_provider_not_eip1193_compatible" | "toolbox_evm_error_estimating_gas_limit" | "toolbox_evm_error_sending_transaction" | "toolbox_radix_signer_not_defined" | "toolbox_solana_no_signer" | "toolbox_solana_fee_estimation_failed" | "toolbox_ripple_rpc_not_configured" | "toolbox_ripple_signer_not_found" | "toolbox_ripple_asset_not_supported" | "toolbox_ripple_broadcast_error" | "toolbox_ripple_get_balance_error" | "helpers_invalid_number_different_decimals" | "helpers_invalid_number_of_years" | "helpers_invalid_identifier" | "helpers_invalid_asset_url" | "helpers_invalid_asset_identifier" | "helpers_invalid_memo_type" | "helpers_failed_to_switch_network" | "helpers_not_found_provider" | "not_implemented"; info?: Record<string, any>; }

any

SwapKitError

Error.constructor

optional cause: unknown

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

The cause of the error.

Error.cause


message: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Error.message


name: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Error.name


optional stack: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Error.stack


static ErrorCode: object = errorCodes

Defined in: packages/helpers/src/modules/swapKitError.ts:178

readonly api_v2_invalid_method_key_hash: 50003 = 50003

readonly api_v2_invalid_response: 50001 = 50001

SwapKit API

readonly api_v2_server_error: 50002 = 50002

readonly chainflip_broker_fund_invalid_address: 30106 = 30106

readonly chainflip_broker_fund_only_flip_supported: 30105 = 30105

readonly chainflip_broker_invalid_params: 30100 = 30100

readonly chainflip_broker_recipient_error: 30101 = 30101

readonly chainflip_broker_register: 30102 = 30102

readonly chainflip_broker_tx_error: 30103 = 30103

readonly chainflip_broker_withdraw: 30104 = 30104

readonly chainflip_channel_error: 30001 = 30001

Chainflip

readonly chainflip_unknown_asset: 30002 = 30002

core_approve_asset_address_or_from_not_found

Section titled “core_approve_asset_address_or_from_not_found”

readonly core_approve_asset_address_or_from_not_found: 10005 = 10005

readonly core_approve_asset_target_invalid: 10008 = 10008

readonly core_chain_halted: 10099 = 10099

core_estimated_max_spendable_chain_not_supported

Section titled “core_estimated_max_spendable_chain_not_supported”

readonly core_estimated_max_spendable_chain_not_supported: 10002 = 10002

Core

readonly core_explorer_unsupported_chain: 10009 = 10009

readonly core_extend_error: 10003 = 10003

readonly core_inbound_data_not_found: 10004 = 10004

readonly core_plugin_not_found: 10006 = 10006

readonly core_plugin_swap_not_found: 10007 = 10007

readonly core_swap_asset_not_recognized: 10202 = 10202

readonly core_swap_contract_not_found: 10203 = 10203

readonly core_swap_contract_not_supported: 10205 = 10205

readonly core_swap_invalid_params: 10200 = 10200

Core - Swap

readonly core_swap_quote_mode_not_supported: 10207 = 10207

readonly core_swap_route_not_complete: 10201 = 10201

readonly core_swap_route_transaction_not_found: 10204 = 10204

readonly core_swap_transaction_error: 10206 = 10206

core_transaction_add_liquidity_asset_error

Section titled “core_transaction_add_liquidity_asset_error”

readonly core_transaction_add_liquidity_asset_error: 10308 = 10308

core_transaction_add_liquidity_base_address

Section titled “core_transaction_add_liquidity_base_address”

readonly core_transaction_add_liquidity_base_address: 10306 = 10306

readonly core_transaction_add_liquidity_base_error: 10307 = 10307

core_transaction_add_liquidity_invalid_params

Section titled “core_transaction_add_liquidity_invalid_params”

readonly core_transaction_add_liquidity_invalid_params: 10305 = 10305

core_transaction_create_liquidity_asset_error

Section titled “core_transaction_create_liquidity_asset_error”

readonly core_transaction_create_liquidity_asset_error: 10303 = 10303

core_transaction_create_liquidity_base_error

Section titled “core_transaction_create_liquidity_base_error”

readonly core_transaction_create_liquidity_base_error: 10302 = 10302

core_transaction_create_liquidity_invalid_params

Section titled “core_transaction_create_liquidity_invalid_params”

readonly core_transaction_create_liquidity_invalid_params: 10304 = 10304

readonly core_transaction_deposit_error: 10301 = 10301

Core - Transaction

readonly core_transaction_deposit_gas_error: 10312 = 10312

core_transaction_deposit_insufficient_funds_error

Section titled “core_transaction_deposit_insufficient_funds_error”

readonly core_transaction_deposit_insufficient_funds_error: 10311 = 10311

readonly core_transaction_deposit_server_error: 10314 = 10314

readonly core_transaction_deposit_to_pool_error: 10310 = 10310

readonly core_transaction_failed: 10316 = 10316

core_transaction_invalid_recipient_address

Section titled “core_transaction_invalid_recipient_address”

readonly core_transaction_invalid_recipient_address: 10317 = 10317

readonly core_transaction_invalid_sender_address: 10313 = 10313

readonly core_transaction_user_rejected: 10315 = 10315

readonly core_transaction_withdraw_error: 10309 = 10309

readonly core_verify_message_not_supported: 10010 = 10010

readonly core_wallet_connection_failed: 10112 = 10112

readonly core_wallet_connection_not_found: 10100 = 10100

Core - Wallet

readonly core_wallet_ctrl_not_installed: 10101 = 10101

readonly core_wallet_evmwallet_not_installed: 10102 = 10102

readonly core_wallet_keepkey_not_installed: 10109 = 10109

readonly core_wallet_keplr_not_installed: 10107 = 10107

readonly core_wallet_keystore_not_installed: 10104 = 10104

readonly core_wallet_ledger_not_installed: 10105 = 10105

readonly core_wallet_not_keypair_wallet: 10111 = 10111

readonly core_wallet_okx_not_installed: 10108 = 10108

readonly core_wallet_sign_message_not_supported: 10110 = 10110

readonly core_wallet_talisman_not_installed: 10110 = 10110

readonly core_wallet_trezor_not_installed: 10106 = 10106

readonly core_wallet_walletconnect_not_installed: 10103 = 10103

readonly helpers_failed_to_switch_network: 99103 = 99103

readonly helpers_invalid_asset_identifier: 99004 = 99004

readonly helpers_invalid_asset_url: 99003 = 99003

readonly helpers_invalid_identifier: 99002 = 99002

readonly helpers_invalid_memo_type: 99005 = 99005

readonly helpers_invalid_number_different_decimals: 99000 = 99000

Helpers

readonly helpers_invalid_number_of_years: 99001 = 99001

readonly helpers_not_found_provider: 99200 = 99200

readonly not_implemented: 99999 = 99999

Anything else

readonly thorchain_chain_halted: 40001 = 40001

THORChain

readonly thorchain_preferred_asset_payout_required: 40104 = 40104

readonly thorchain_swapin_memo_required: 40102 = 40102

readonly thorchain_swapin_router_required: 40100 = 40100

readonly thorchain_swapin_token_required: 40103 = 40103

readonly thorchain_swapin_vault_required: 40101 = 40101

readonly thorchain_trading_halted: 40002 = 40002

readonly toolbox_cosmos_no_accounts_found: 90102 = 90102

readonly toolbox_cosmos_signer_not_defined: 90101 = 90101

Toolboxes

toolbox_cosmos_validate_address_prefix_not_found

Section titled “toolbox_cosmos_validate_address_prefix_not_found”

readonly toolbox_cosmos_validate_address_prefix_not_found: 90104 = 90104

readonly toolbox_cosmos_verify_signature_no_pubkey: 90103 = 90103

readonly toolbox_evm_error_estimating_gas_limit: 90211 = 90211

readonly toolbox_evm_error_sending_transaction: 90212 = 90212

readonly toolbox_evm_invalid_gas_asset_address: 90209 = 90209

readonly toolbox_evm_no_abi_fragment: 90201 = 90201

readonly toolbox_evm_no_contract_address: 90205 = 90205

readonly toolbox_evm_no_fee_data: 90206 = 90206

readonly toolbox_evm_no_from_address: 90204 = 90204

readonly toolbox_evm_no_gas_price: 90207 = 90207

readonly toolbox_evm_no_signer: 90202 = 90202

readonly toolbox_evm_no_signer_address: 90203 = 90203

readonly toolbox_evm_no_to_address: 90208 = 90208

toolbox_evm_provider_not_eip1193_compatible

Section titled “toolbox_evm_provider_not_eip1193_compatible”

readonly toolbox_evm_provider_not_eip1193_compatible: 90210 = 90210

readonly toolbox_radix_signer_not_defined: 90301 = 90301

readonly toolbox_ripple_asset_not_supported: 90503 = 90503

readonly toolbox_ripple_broadcast_error: 90504 = 90504

readonly toolbox_ripple_get_balance_error: 90505 = 90505

readonly toolbox_ripple_rpc_not_configured: 90501 = 90501

readonly toolbox_ripple_signer_not_found: 90502 = 90502

readonly toolbox_solana_fee_estimation_failed: 90402 = 90402

readonly toolbox_solana_no_signer: 90401 = 90401

readonly wallet_bitkeep_not_found: 21001 = 21001

readonly wallet_chain_not_supported: 20002 = 20002

readonly wallet_connection_rejected_by_user: 20000 = 20000

Wallets

readonly wallet_ctrl_asset_not_defined: 20304 = 20304

readonly wallet_ctrl_contract_address_not_provided: 20303 = 20303

readonly wallet_ctrl_not_found: 20301 = 20301

readonly wallet_ctrl_send_transaction_no_address: 20302 = 20302

readonly wallet_exodus_sign_transaction_error: 21100 = 21100

readonly wallet_failed_to_add_or_switch_network: 20005 = 20005

readonly wallet_keepkey_asset_not_defined: 20901 = 20901

wallet_keepkey_contract_address_not_provided

Section titled “wallet_keepkey_contract_address_not_provided”

readonly wallet_keepkey_contract_address_not_provided: 20902 = 20902

readonly wallet_keepkey_not_found: 20900 = 20900

wallet_keepkey_send_transaction_no_address

Section titled “wallet_keepkey_send_transaction_no_address”

readonly wallet_keepkey_send_transaction_no_address: 20903 = 20903

readonly wallet_keystore_invalid_password: 29900 = 29900

readonly wallet_keystore_unsupported_version: 29901 = 29901

readonly wallet_ledger_connection_claimed: 20102 = 20102

readonly wallet_ledger_connection_error: 20101 = 20101

readonly wallet_ledger_device_locked: 20105 = 20105

readonly wallet_ledger_device_not_found: 20104 = 20104

readonly wallet_ledger_get_address_error: 20103 = 20103

readonly wallet_missing_api_key: 20001 = 20001

readonly wallet_missing_params: 20003 = 20003

readonly wallet_onekey_not_found: 21200 = 21200

readonly wallet_onekey_sign_transaction_error: 21201 = 21201

readonly wallet_phantom_not_found: 20201 = 20201

readonly wallet_polkadot_not_found: 20701 = 20701

readonly wallet_provider_not_found: 20004 = 20004

readonly wallet_radix_not_found: 20801 = 20801

readonly wallet_radix_transaction_failed: 20802 = 20802

readonly wallet_talisman_not_enabled: 20601 = 20601

readonly wallet_talisman_not_found: 20602 = 20602

wallet_trezor_derivation_path_not_supported

Section titled “wallet_trezor_derivation_path_not_supported”

readonly wallet_trezor_derivation_path_not_supported: 20502 = 20502

readonly wallet_trezor_failed_to_get_address: 20503 = 20503

readonly wallet_trezor_failed_to_sign_transaction: 20501 = 20501

wallet_walletconnect_connection_not_established

Section titled “wallet_walletconnect_connection_not_established”

readonly wallet_walletconnect_connection_not_established: 20402 = 20402

wallet_walletconnect_namespace_not_supported

Section titled “wallet_walletconnect_namespace_not_supported”

readonly wallet_walletconnect_namespace_not_supported: 20403 = 20403

wallet_walletconnect_project_id_not_specified

Section titled “wallet_walletconnect_project_id_not_specified”

readonly wallet_walletconnect_project_id_not_specified: 20401 = 20401


static optional prepareStackTrace: (err, stackTraces) => any

Defined in: node_modules/bun-types/globals.d.ts:962

Optional override for formatting stack traces

Error

CallSite[]

any

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Error.prepareStackTrace


static stackTraceLimit: number

Defined in: node_modules/@types/bun/node_modules/bun-types/globals.d.ts:960

The maximum number of stack frames to capture.

Error.stackTraceLimit

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/@types/bun/node_modules/bun-types/globals.d.ts:955

Create .stack property on a target object

object

Function

void

Error.captureStackTrace

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/bun-types/globals.d.ts:955

Create .stack property on a target object

object

Function

void

Error.captureStackTrace

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/@types/node/globals.d.ts:145

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();

object

Function

void

Error.captureStackTrace


static isError(value): value is Error

Defined in: node_modules/@types/bun/node_modules/bun-types/globals.d.ts:950

Check if a value is an instance of Error

unknown

The value to check

value is Error

True if the value is an instance of Error, false otherwise

Error.isError

static isError(value): value is Error

Defined in: node_modules/bun-types/globals.d.ts:950

Check if a value is an instance of Error

unknown

The value to check

value is Error

True if the value is an instance of Error, false otherwise

Error.isError