Global / workspace error handler template

Script windmill Verified

by hugo697 ยท 7/6/2023

The script

Submitted by hugo697 Bun
Verified 618 days ago
1
// Global / workspace error handler template
2

3
export async function main(
4
  path: string, // The path of the script or flow that errored
5
  email: string, // The email of the user who ran the script or flow that errored
6
  error: object, // The error details
7
  job_id: string, // The job id
8
  is_flow: boolean, // Whether the error comes from a flow
9
  workspace_id: string // The workspace id of the failed script or flow
10
) {
11
  const run_type = is_flow ? "flow" : "script";
12
  console.log(
13
    `An error occured with ${run_type} ${path} run by ${email} in workspace ${workspace_id}`
14
  );
15
  console.log(error);
16
  return error;
17
}
Other submissions
  • Submitted by hugo697 Deno
    Created 943 days ago
    1
    // Global / workspace error handler template
    2
    
    
    3
    export async function main(
    4
      path: string, // The path of the script or flow that errored
    5
      email: string, // The email of the user who ran the script or flow that errored
    6
      error: object, // The error details
    7
      job_id: string, // The job id
    8
      is_flow: boolean, // Whether the error comes from a flow
    9
      workspace_id: string // The workspace id of the failed script or flow
    10
    ) {
    11
      const run_type = is_flow ? "flow" : "script";
    12
      console.log(
    13
        `An error occured with ${run_type} ${path} run by ${email} in workspace ${workspace_id}`
    14
      );
    15
      console.log(error);
    16
      return error;
    17
    }
    18