Error Handling
There are 5 ways to do error handling in getOperate.
try/catch inside a Script
One way to handle errors in getOperate is by using the try/catch
block within a Script. This method is not specific to getOperate and can be used in any programming language that supports exception handling.
Here is an example in TypeScript:
Flows’ Error Handlers
The Error Handler is a special flow step that is executed when an error occurs within a flow.
If defined, the error handler will take as input the result of the step that errored (which has its error in the ‘error field’).
Error Handler
Configure a script to handle errors.
Special Case: Error Handling in Flows
There are other tricks to do Error handling in flows, see:
Error Handling in Flows
There are four ways to handle errors in getOperate flows.
Schedules’ Error Handlers
Add a special script or flow to execute in case of an error in your scheduled script or flow.
You can pick the Slack pre-set schedule error handler or define your own.
Schedules
Scheduling allows you to define schedules for Scripts and Flows, automatically running them at set frequencies.
Workspace Error Handler
Workspace Error Handler on Slack
On Cloud, Self-Host Pro & Enterprise Editions, you can connect workspace to Slack and enable an automated error handler on a given channel.
Custom Workspace Error Handler
You can also define a custom script or flow to be executed automatically in case of error in the workspace.
From the workspace settings, on the “Error Handler” tab and pick a script or flow.
The following args will be passed to the error handler:
- path: The path of the script or flow that errored.
- email: The email of the user who ran the script or flow that errored.
- error: The error details.
- job_id: The job id.
- is_flow: Whether the error comes from a flow.
- workspace_id: The workspace id of the failed script or flow.
The Error handler will be executed by the automatically created group g/error_handler. If your error handler requires variables or resources, you need to add them to the group.
Here is a template for your workspace error handler:
Instance Error Handler
You can define a script to be executed automatically in case of error in your instance (all workspaces).
This Superadmin Error handler is defined by setting the path to the script to be executed as an env variable to all servers using: GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE
.
The following args will be passed to the error handler:
- path: The path of the script or flow that errored.
- email: The email of the user who ran the script or flow that errored.
- error: The error details.
- job_id: The job id.
- is_flow: Whether the error comes from a flow.
- workspace_id: The workspace id of the failed script or flow.
Here is a template for your workspace error handler: