Function tryOr

Produce a Task<T, E> from a Promise<T> and use a fallback value if the task rejects, ignoring the rejection reason.

Notes:

  • To leave any error as unknown, use the overload which accepts only the promise.
  • To handle the rejection reason rather than ignoring it, use the overload which accepts a function.
  • Produce a Task<T, E> from a Promise<T> and use a fallback value if the task rejects, ignoring the rejection reason.

    Notes:

    • To leave any error as unknown, use the overload which accepts only the promise.
    • To handle the rejection reason rather than ignoring it, use the overload which accepts a function.

    Type Parameters

    • T
    • E

    Parameters

    • promise: Promise<T>

      The promise from which to create the Task.

    • rejectionValue: E

      A function to transform an unknown rejection reason into a known E.

    Returns Task<T, E>

    This will be removed at 9.0. Switch to the module-level function safelyTryOr, which accepts a callback instead.