Skip to main content
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.

How to catch errors inside run()

You have two options:
  1. Use the io.try() function documented on this page.
  2. Use a regular try/catch block and isTriggerError to check if the error is a special error type.

Parameters

required
The code you wish to run
required
This will be called if the Task fails. The callback receives the error

Returns

required
A Promise that resolves with the returned value or the error