RTCForge API Reference v1.1.1
    Preparing search index...

    Function isRtcForgeError

    • Type guard that checks whether a value is a RtcForgeError, optionally matching a specific error code.

      Parameters

      • err: unknown

        The value to test, typically a caught unknown.

      • Optionalcode: string

        When provided, additionally requires the error's code to equal this value.

      Returns err is RtcForgeError

      true if err is a RtcForgeError (and matches code when given), narrowing its type.

      try {
      doWork()
      } catch (err) {
      if (isRtcForgeError(err, 'INVALID_ARGUMENT')) {
      // err is narrowed to RtcForgeError here
      retryWithDefaults()
      }
      }