TSS SDK Errors

There are various errors that can occur when using the library. These errors are thrown as a custom error class, TssError.

The TssError class has the following properties:

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

  • code - The error code.

  • message - The error message.

  • cause - The error that caused this error.

Error codes

The following error codes are used by the library:

Error codes from the TSS library operation

  • TSS_NO_ERROR

  • TSS_INVALID_HANDLE

  • TSS_HANDLE_IN_USE

  • TSS_INVALID_HANDLE_TYPE

  • TSS_NULL_PTR

  • TSS_INVALID_SESSION_ID

  • TSS_INVALID_SESSION_STATE

  • TSS_UNKNOWN_ERROR

  • TSS_SERIALIZATION_ERROR

  • TSS_PROCESS_MESSAGE_ERROR

  • TSS_INVALID_MSG_HASH

  • TSS_INVALID_DERIVATION_PATH_STR

  • TSS_MESSAGE_SIGNATURE

  • TSS_MESSAGE_SIGN_PK

  • TSS_MESSAGE_SIGN_VERIFY

Error codes from the TSS library JS and Native API

  • TSS_INVALID_PARAM

  • TSS_PROCESS_MESSAGE_ERROR

  • BAD_BASE_64

Example usage

try {
  // TSS operations
  // keygen
  // sign
  // key-refresh
} catch (error: any) {
  // Checking error this from TssError
  if (error instanceof TssError) {
    console.log(error.code);
    console.log(error.message);
    console.log('TSS failed!', error.message);
  } else {
    // Other errors
    console.log(error);
    console.log('Error!', error.message);
  }
} 

Last updated