Helpful
    Preparing search index...

    Function tryFallbackAsync

    Invokes the candidate function and returns undefined if an rejected promise is returned from it.

    The candidate function to run.

    The optional fallback value to return if the candidate throws an Error.

    A promise that resolves with the result from candidate or fallback if candidate returns a rejected promise. Resolves with undefined if no fallback is provided.

    • Invokes the candidate function and returns undefined if an rejected promise is returned from it.

      Type Parameters

      • T

      Parameters

      • candidate: () => Promise<T>

        The candidate function to run.

      Returns Promise<T | undefined>

      A promise that resolves with the result from candidate. Returns undefined if candidate returns a rejected promise.

    • Invokes the candidate function and returns undefined if an rejected promise is returned from it.

      Type Parameters

      • T

      Parameters

      • candidate: () => Promise<T>

        The candidate function to run.

      • fallback: T

        The fallback value that will be returned if candidate returns a rejected promise.

      Returns Promise<T>

      A promise that resolves with the result from candidate. Returns fallback if candidate returns a rejected promise.