LogoLogo
Duo SDK
  • Introduction
  • Overview
  • Code Stack
  • HOW TO
    • Silent Shard Duo SDK Example
      • Admin
      • Server Node
      • Client Node
        • React-Native
          • Installing Silent Shard Duo RN SDK
          • Quick start
          • Error handling
          • Hooks
            • useECDSAKeyGen
            • useECDSASignGen
            • useECDSAKeyRefresh
          • Functions
            • keyGenECDSA
            • signGenECDSA
            • keyRefreshECDSA
          • Classes
            • ECDSAP1PartyKeys class
            • ECDSAP1KeyshareV2 class
  • ADVANCED SETUP
    • Low Level API
      • Key Generation
      • Sign
      • Key Rotation
    • MPC + Account Abstraction Kits
      • Biconomy Smart Accounts
        • Quick Start
        • Using the CLI version
        • Experience this in a Biconomy x SL powered DApp
      • Stackup Account Abstraction SDK
        • Quick Start
        • Using the CLI version
        • Experience it in a Stackup x SL powered DApp
      • Resources
        • Structure of the repository
        • Integration and Hosting
  • REFERENCE
    • MetaMask Snap
    • Contact Us
Powered by GitBook
On this page
  1. HOW TO
  2. Silent Shard Duo SDK Example
  3. Client Node
  4. React-Native

Error handling

The react-native-duo-sdk exports a DuoSDKError class that can be used to handle errors that occur during the use of the Duo SDK.

The DuoSDKError class contains the following properties:

  • name - The name of the error. Always DuoSDKError.

  • code - The error code.

  • message - The error message.

  • cause - The error that caused this error or undefined.

Example usage

try {
  // any async duo sdk function
} catch (error: any) {
  if (error instanceof DuoSDKError) {
    console.log(error.code);
    console.log(error.message);
    console.log('DuoSDKError failed!', error.message);
  } else {
    // Other errors
    console.log(error);
    console.log('Error!', error.message);
  }
} 

Last updated 1 year ago