0
Schedule error handler template
One script reply has been approved by the moderators Verified
Created by hugo697 741 days ago Viewed 23009 times
0
Submitted by hugo697 Bun
Verified 306 days ago
1
// Schedule error handler template
2

3
export async function main(
4
  workspace_id: string, // The ID of the workspace that the schedule belongs to
5
  job_id: string, // The UUID of the job that errored
6
  path: string, // The path of the script or flow that errored
7
  is_flow: boolean, // Whether the runnable is a flow
8
  schedule_path: string, // The path of the schedule
9
  error: object, // The error details
10
  started_at: string, // The start datetime of the latest job that failed
11
  failed_times: number // Minimum number of times the schedule failed before calling the error handler
12
) {
13
  console.log(
14
    `Schedule ${schedule_path} failed ${failed_times > 1 ? failed_times + " times in a row" : ""}\n${
15
      is_flow ? "Flow" : "Script"
16
    }: ${path}`
17
  );
18
  console.log(`Last failed job started at ${started_at}:`, error);
19
  return error;
20
}
21

Other submissions