# NOT RUN {
## 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")
)
## 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)
)
# }
Run the code above in your browser using DataCamp Workspace