Trigger error handler template

Script windmill Verified

by hugo697 ยท 7/11/2025

The script

Submitted by hugo697 Bun
Verified 305 days ago
1
// Trigger error handler template
2

3
export async function main(
4
  workspace_id: string, // The ID of the workspace that the trigger 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
  error: object, // The error details
9
  started_at: string, // The start datetime of the job that failed
10
  trigger_path: string // The path of the trigger that errored in the format <trigger_type>/<trigger_path>
11
) {
12
  const triggerType = trigger_path.split("/")[0];
13
  const triggerPath = trigger_path.replace(triggerType + "/", "");
14
  console.log(`${triggerType} ${triggerPath} failed\n${is_flow ? "Flow" : "Script"}: ${path}`);
15
  console.log(`Failed job started at ${started_at}:`, error);
16
  return error;
17
}
18