io.try()
allows you to run Tasks and catch any errors that are thrown, it’s similar to a normal try/catch
block but works with io.runTask().
A regular try/catch
block on its own won’t work as expected with Tasks. Internally runTask()
throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
catch
errors inside run()
You have two options:
io.try()
function documented on this page.try/catch
block and isTriggerError to check if the error is a special error type.The code you wish to run
This will be called if the Task fails. The callback receives the error
A Promise that resolves with the returned value or the error
io.try()
allows you to run Tasks and catch any errors that are thrown, it’s similar to a normal try/catch
block but works with io.runTask().
A regular try/catch
block on its own won’t work as expected with Tasks. Internally runTask()
throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
catch
errors inside run()
You have two options:
io.try()
function documented on this page.try/catch
block and isTriggerError to check if the error is a special error type.The code you wish to run
This will be called if the Task fails. The callback receives the error
A Promise that resolves with the returned value or the error