// Trigger error handler template
export async function main(
workspace_id: string, // The ID of the workspace that the trigger belongs to
job_id: string, // The UUID of the job that errored
path: string, // The path of the script or flow that errored
is_flow: boolean, // Whether the runnable is a flow
error: object, // The error details
started_at: string, // The start datetime of the job that failed
trigger_path: string // The path of the trigger that errored in the format <trigger_type>/<trigger_path>
) {
const triggerType = trigger_path.split("/")[0];
const triggerPath = trigger_path.replace(triggerType + "/", "");
console.log(`${triggerType} ${triggerPath} failed\n${is_flow ? "Flow" : "Script"}: ${path}`);
console.log(`Failed job started at ${started_at}:`, error);
return error;
}
Submitted by hugo697 305 days ago