If the deferred value is not resolved before the timeout expires,
async_timeout()
throws an async_timeout
error.
async_timeout(task, timeout, ...)
A deferred value. An async_timeout
error is thrown if it is
not resolved within the specified timeout.
## You can catch the error, asynchronously
synchronise(
async_timeout(function() delay(1/10)$then(function() "OK"), 1/1000)$
catch(async_timeout = function(e) "Timed out",
error = function(e) "Other error")
)
#> [1] "Timed out"
## Or synchronously
tryCatch(
synchronise(
async_timeout(function() delay(1/10)$then(function() "OK"), 1/1000)
),
async_timeout = function(e) "Timed out. :(",
error = function(e) paste("Other error:", e$message)
)
#> [1] "Timed out. :("