async (version 0.0.0.9004)

async_reflect: Make an asynchronous function that always succeeds

Description

This is sometimes useful, if the function is applied to entries in a vector or list.

Usage

async_reflect(task)

Arguments

task

Function to transform.

Value

Async function returning a deferred value that is never rejected. Instead its value is a list with entries error and result. If the original deferred was resolved, then error is NULL. If the original deferred was rejected, then result is NULL.

See Also

Other async control flow: async_retryable, async_retry, async_sequence, async_try_each, async_until, async_whilst

Examples

Run this code
# NOT RUN {
 badfun <- async(function() stop("oh no!"))
 safefun <- async_reflect(badfun)
 synchronise(when_all(safefun(), "good"))
# }

Run the code above in your browser using DataCamp Workspace