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