Fraci
    Preparing search index...

    Function getFraciErrorCode

    • Extracts the error code from a FraciError.

      This function safely extracts the error code without requiring type checking first. If the error is not a FraciError, it returns undefined.

      Parameters

      • error: unknown

        The error to extract the code from

      Returns undefined | FraciErrorCode

      The FraciErrorCode if the error is a FraciError, undefined otherwise

      try {
      // Some Fraci operation
      } catch (error) {
      switch (getFraciErrorCode(error)) {
      case "MAX_LENGTH_EXCEEDED":
      case "MAX_RETRIES_EXCEEDED":
      // Handle specific error case
      break;

      default:
      // Handle other cases, including unknown errors
      // or Fraci errors that are not handled above
      break;
      }
      }